Skip to content
Snippets Groups Projects
Commit c4c1da27 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '12-upgrade-flutter-framework-and-dependencies' into 'master'

Resolve "Upgrade flutter framework and dependencies"

Closes #12

See merge request !11
parents f650a0ef c861c6ea
No related branches found
No related tags found
1 merge request!11Resolve "Upgrade flutter framework and dependencies"
Pipeline #3493 passed
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=0.0.9 app.versionName=0.0.10
app.versionCode=9 app.versionCode=10
Upgrade Flutter framework and dependencies, clean some code
Mise à jour du framework Flutter et de ses dépendances, nettoyage de code
import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../provider/data.dart'; import '../provider/data.dart';
import '../utils/api.dart'; import '../utils/api.dart';
class Keyboard { class Keyboard {
static Container buildWidget(Data myProvider) { static Container buildWidget(Data myProvider) {
Widget buildKeyWidget(String direction) { Widget buildKeyWidget(String direction) {
String keyText = ''; String keyText = '';
...@@ -36,14 +33,12 @@ class Keyboard { ...@@ -36,14 +33,12 @@ class Keyboard {
style: TextButton.styleFrom( style: TextButton.styleFrom(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
), ),
child: Text( child: Text(keyText,
keyText,
style: TextStyle( style: TextStyle(
fontSize: 60.0, fontSize: 60.0,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
), ),
textAlign: TextAlign.center textAlign: TextAlign.center),
),
onPressed: () { onPressed: () {
if (keyText != '') { if (keyText != '') {
Api.move(myProvider, direction); Api.move(myProvider, direction);
...@@ -55,34 +50,25 @@ class Keyboard { ...@@ -55,34 +50,25 @@ class Keyboard {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 2), margin: EdgeInsets.symmetric(horizontal: 2),
padding: EdgeInsets.all(2), padding: EdgeInsets.all(2),
child: Table( child: Table(
defaultVerticalAlignment: TableCellVerticalAlignment.middle, defaultVerticalAlignment: TableCellVerticalAlignment.middle,
children: [ children: [
TableRow( TableRow(children: [
children: [
TableCell(child: buildKeyWidget('')), TableCell(child: buildKeyWidget('')),
TableCell(child: buildKeyWidget('north')), TableCell(child: buildKeyWidget('north')),
TableCell(child: buildKeyWidget('')), TableCell(child: buildKeyWidget('')),
] ]),
), TableRow(children: [
TableRow(
children: [
TableCell(child: buildKeyWidget('west')), TableCell(child: buildKeyWidget('west')),
TableCell(child: buildKeyWidget('')), TableCell(child: buildKeyWidget('')),
TableCell(child: buildKeyWidget('east')), TableCell(child: buildKeyWidget('east')),
] ]),
), TableRow(children: [
TableRow(
children: [
TableCell(child: buildKeyWidget('')), TableCell(child: buildKeyWidget('')),
TableCell(child: buildKeyWidget('south')), TableCell(child: buildKeyWidget('south')),
TableCell(child: buildKeyWidget('')), TableCell(child: buildKeyWidget('')),
] ]),
),
], ],
) ));
);
} }
} }
...@@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart'; ...@@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class Data extends ChangeNotifier { class Data extends ChangeNotifier {
// Application settings // Application settings
String _apiHost = ''; String _apiHost = '';
String _apiStatus = ''; String _apiStatus = '';
...@@ -11,15 +10,20 @@ class Data extends ChangeNotifier { ...@@ -11,15 +10,20 @@ class Data extends ChangeNotifier {
getParameterValue(String parameterCode) { getParameterValue(String parameterCode) {
switch (parameterCode) { switch (parameterCode) {
case 'apiHost': { return _apiHost; } case 'apiHost':
break; {
return _apiHost;
}
} }
} }
setParameterValue(String parameterCode, String parameterValue) async { setParameterValue(String parameterCode, String parameterValue) async {
print('set parameter "' + parameterCode + '" to value "' + parameterValue + '"'); print('set parameter "' + parameterCode + '" to value "' + parameterValue + '"');
switch (parameterCode) { switch (parameterCode) {
case 'apiHost': { updateApiHost(parameterValue); } case 'apiHost':
{
updateApiHost(parameterValue);
}
break; break;
} }
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
......
...@@ -29,7 +29,6 @@ class _HomeState extends State<Home> { ...@@ -29,7 +29,6 @@ class _HomeState extends State<Home> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: new Text('Stepper plotter assistant'), title: new Text('Stepper plotter assistant'),
actions: [ actions: [
IconButton( IconButton(
icon: Icon(Icons.settings), icon: Icon(Icons.settings),
...@@ -43,7 +42,6 @@ class _HomeState extends State<Home> { ...@@ -43,7 +42,6 @@ class _HomeState extends State<Home> {
}, },
) )
], ],
leading: IconButton( leading: IconButton(
icon: Image.asset('assets/icons/application.png'), icon: Image.asset('assets/icons/application.png'),
onPressed: () {}, onPressed: () {},
...@@ -54,18 +52,15 @@ class _HomeState extends State<Home> { ...@@ -54,18 +52,15 @@ class _HomeState extends State<Home> {
child: Column( child: Column(
children: [ children: [
Keyboard.buildWidget(myProvider), Keyboard.buildWidget(myProvider),
FlatButton( TextButton(
child: Container( child: Container(
child: Text('get API status'), child: Text('get API status'),
), ),
onPressed: () => Api.updateApiStatus(myProvider), onPressed: () => Api.updateApiStatus(myProvider),
), ),
Text(myProvider.apiStatus) Text(myProvider.apiStatus)
], ],
) )),
), ));
)
);
} }
} }
...@@ -29,7 +29,6 @@ class _SettingsPageState extends State<SettingsPage> { ...@@ -29,7 +29,6 @@ class _SettingsPageState extends State<SettingsPage> {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: new Text('Stepper - settings'), title: new Text('Stepper - settings'),
actions: [ actions: [
IconButton( IconButton(
icon: Icon(Icons.save), icon: Icon(Icons.save),
...@@ -39,13 +38,11 @@ class _SettingsPageState extends State<SettingsPage> { ...@@ -39,13 +38,11 @@ class _SettingsPageState extends State<SettingsPage> {
}, },
) )
], ],
leading: IconButton( leading: IconButton(
icon: Image.asset('assets/icons/application.png'), icon: Image.asset('assets/icons/application.png'),
onPressed: () {}, onPressed: () {},
), ),
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: TextFormField( child: TextFormField(
......
...@@ -4,14 +4,8 @@ import 'package:http/http.dart' as http; ...@@ -4,14 +4,8 @@ import 'package:http/http.dart' as http;
import '../provider/data.dart'; import '../provider/data.dart';
class Api { class Api {
static Future<void> updateApiStatus(Data myProvider) async { static Future<void> updateApiStatus(Data myProvider) async {
final response = await http.get( final response = await http.get(Uri.http(myProvider.apiHost, 'status'));
Uri.http(
myProvider.apiHost,
'status'
)
);
String responseData = utf8.decode(response.bodyBytes); String responseData = utf8.decode(response.bodyBytes);
Map<String, dynamic> status = json.decode(responseData); Map<String, dynamic> status = json.decode(responseData);
...@@ -20,18 +14,11 @@ class Api { ...@@ -20,18 +14,11 @@ class Api {
} }
static Future<void> move(Data myProvider, String direction) async { 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); String responseData = utf8.decode(response.bodyBytes);
Map<String, dynamic> result = json.decode(responseData); Map<String, dynamic> result = json.decode(responseData);
myProvider.updateApiStatus(result['result']); myProvider.updateApiStatus(result['result']);
} }
} }
...@@ -7,7 +7,7 @@ packages: ...@@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.2" version: "2.9.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
...@@ -21,21 +21,14 @@ packages: ...@@ -21,21 +21,14 @@ packages:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
...@@ -49,7 +42,7 @@ packages: ...@@ -49,7 +42,7 @@ packages:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
...@@ -63,7 +56,7 @@ packages: ...@@ -63,7 +56,7 @@ packages:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.2" version: "6.1.4"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
...@@ -85,7 +78,7 @@ packages: ...@@ -85,7 +78,7 @@ packages:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.13.4" version: "0.13.5"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
...@@ -106,21 +99,21 @@ packages: ...@@ -106,21 +99,21 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.11" version: "0.12.12"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4" version: "0.1.5"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.8.0"
nested: nested:
dependency: transitive dependency: transitive
description: description:
...@@ -134,7 +127,7 @@ packages: ...@@ -134,7 +127,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
...@@ -155,7 +148,7 @@ packages: ...@@ -155,7 +148,7 @@ packages:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.3"
platform: platform:
dependency: transitive dependency: transitive
description: description:
...@@ -169,7 +162,7 @@ packages: ...@@ -169,7 +162,7 @@ packages:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" version: "2.1.3"
process: process:
dependency: transitive dependency: transitive
description: description:
...@@ -197,7 +190,7 @@ packages: ...@@ -197,7 +190,7 @@ packages:
name: shared_preferences_android name: shared_preferences_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.12" version: "2.0.13"
shared_preferences_ios: shared_preferences_ios:
dependency: transitive dependency: transitive
description: description:
...@@ -225,7 +218,7 @@ packages: ...@@ -225,7 +218,7 @@ packages:
name: shared_preferences_platform_interface name: shared_preferences_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.1.0"
shared_preferences_web: shared_preferences_web:
dependency: transitive dependency: transitive
description: description:
...@@ -251,7 +244,7 @@ packages: ...@@ -251,7 +244,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.2" version: "1.9.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
...@@ -272,21 +265,21 @@ packages: ...@@ -272,21 +265,21 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9" version: "0.4.12"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
...@@ -307,14 +300,14 @@ packages: ...@@ -307,14 +300,14 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.7.0" version: "3.0.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0+1" version: "0.2.0+2"
sdks: sdks:
dart: ">=2.17.0 <3.0.0" dart: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0" flutter: ">=3.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() {
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment