From ee99869cf62209984d88de705c653a77fc98d3f8 Mon Sep 17 00:00:00 2001 From: Timo Reichl Date: Tue, 21 Dec 2021 12:22:17 +0100 Subject: [PATCH] fix: warnings (#1) * Ran make format Signed-off-by: Timo Reichl * Add VS Code launch config Signed-off-by: Timo Reichl * pages/list/list.dart: Stop spinning wheel after adding a task Signed-off-by: Timo Reichl * stores/list_store.dart: Fix updateTask() not being a future Signed-off-by: Timo Reichl * Replace FlatButton with TextButton widgets Signed-off-by: Timo Reichl * components/TaskTile.dart: Remove dead code Signed-off-by: Timo Reichl * theme/theme.dart: Fix accentColor deprecation Signed-off-by: Timo Reichl * pages/list/list_edit.dart: Fix SnackBar.hideCurrentSnackBar() deprecation Signed-off-by: Timo Reichl * Remove unused folder lib/managers Signed-off-by: Timo Reichl --- .gitignore | 4 + .vscode/launch.json | 10 +++ lib/api/client.dart | 39 +++++---- lib/api/label_task.dart | 10 ++- lib/api/label_task_bulk.dart | 4 +- lib/api/labels.dart | 9 ++- lib/api/list_implementation.dart | 6 +- lib/components/AddDialog.dart | 4 +- lib/components/ErrorDialog.dart | 2 +- lib/components/TaskTile.dart | 46 +++-------- lib/components/datetimePicker.dart | 4 +- lib/components/string_extension.dart | 1 - lib/global.dart | 6 +- lib/managers/user.dart | 24 ------ lib/models/label.dart | 1 - lib/models/task.dart | 10 +-- lib/models/user.dart | 3 +- lib/pages/home.dart | 65 ++++++++------- lib/pages/list/list.dart | 114 ++++++++++++++------------- lib/pages/list/list_edit.dart | 6 +- lib/pages/list/task_edit.dart | 3 +- lib/pages/namespace/namespace.dart | 7 +- lib/service/mocked_services.dart | 3 +- lib/stores/list_store.dart | 19 +++-- lib/theme/constants.dart | 2 +- lib/theme/theme.dart | 8 +- lib/utils/datetime_to_unix.dart | 2 +- 27 files changed, 195 insertions(+), 217 deletions(-) create mode 100644 .vscode/launch.json delete mode 100644 lib/managers/user.dart diff --git a/.gitignore b/.gitignore index 48f4ca9..928dd44 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ .pub/ /build/ ios/Flutter/flutter_export_environment.sh +analysis_options.yaml # Web related lib/generated_plugin_registrant.dart @@ -45,3 +46,6 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +# VS Code +.vscode/settings.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1b2ba13 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,10 @@ +{ + "configurations": [ + { + "name": "Flutter", + "request": "launch", + "type": "dart", + "flutterMode": "debug" + } + ] +} diff --git a/lib/api/client.dart b/lib/api/client.dart index 1fc7158..f2d1f9f 100644 --- a/lib/api/client.dart +++ b/lib/api/client.dart @@ -42,28 +42,36 @@ class Client { queryParameters: queryParameters, // Because dart takes a Map here, it is only possible to sort by one parameter while the api supports n parameters. fragment: uri.fragment); - return http.get(newUri, headers: _headers) - .then(_handleResponse); + return http.get(newUri, headers: _headers).then(_handleResponse); } Future delete(String url) { - return http.delete('${this.base}$url'.toUri(), - headers: _headers, - ).then(_handleResponse); + return http + .delete( + '${this.base}$url'.toUri(), + headers: _headers, + ) + .then(_handleResponse); } Future post(String url, {dynamic body}) { - return http.post('${this.base}$url'.toUri(), - headers: _headers, - body: _encoder.convert(body), - ).then(_handleResponse); + return http + .post( + '${this.base}$url'.toUri(), + headers: _headers, + body: _encoder.convert(body), + ) + .then(_handleResponse); } Future put(String url, {dynamic body}) { - return http.put('${this.base}$url'.toUri(), - headers: _headers, - body: _encoder.convert(body), - ).then(_handleResponse); + return http + .put( + '${this.base}$url'.toUri(), + headers: _headers, + body: _encoder.convert(body), + ) + .then(_handleResponse); } Response _handleResponse(http.Response response) { @@ -81,10 +89,7 @@ class Client { response.statusCode, response.request.url.toString()); } return Response( - _decoder.convert(response.body), - response.statusCode, - response.headers - ); + _decoder.convert(response.body), response.statusCode, response.headers); } } diff --git a/lib/api/label_task.dart b/lib/api/label_task.dart index e29011f..c9b1b77 100644 --- a/lib/api/label_task.dart +++ b/lib/api/label_task.dart @@ -9,14 +9,16 @@ class LabelTaskAPIService extends APIService implements LabelTaskService { @override Future