From 2720280ada9ec1efe8ad989170e11c857bdde917 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 16 Aug 2021 20:40:29 +1000 Subject: [PATCH] Remove floating action button --- lib/api.dart | 15 +++------------ lib/api_form.dart | 2 +- lib/widget/stock_item_test_results.dart | 22 ++++++++++++---------- pubspec.lock | 7 ------- pubspec.yaml | 1 - 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/lib/api.dart b/lib/api.dart index 7777b1a4..22b9b288 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -262,12 +262,7 @@ class InvenTreeAPI { response = await get("", expectedStatusCode: 200); - // Response was invalid for some reason - if (!response.isValid()) { - return false; - } - - if (response.statusCode != 200) { + if (!response.successful()) { showStatusCodeError(response.statusCode); return false; } @@ -319,11 +314,7 @@ class InvenTreeAPI { response = await get(_URL_GET_TOKEN); // Invalid response - if (!response.isValid()) { - return false; - } - - if (response.statusCode != 200) { + if (!response.successful()) { switch (response.statusCode) { case 401: @@ -419,7 +410,7 @@ class InvenTreeAPI { var response = await get(_URL_GET_ROLES, expectedStatusCode: 200); - if (!response.isValid() || response.statusCode != 200) { + if (!response.successful()) { return; } diff --git a/lib/api_form.dart b/lib/api_form.dart index 51366c13..88ffa885 100644 --- a/lib/api_form.dart +++ b/lib/api_form.dart @@ -144,7 +144,7 @@ class APIFormField { params: filters, ); - if (response.isValid()) { + if (response.successful()) { initial_data = response.data; } } diff --git a/lib/widget/stock_item_test_results.dart b/lib/widget/stock_item_test_results.dart index bb189980..5c8ce974 100644 --- a/lib/widget/stock_item_test_results.dart +++ b/lib/widget/stock_item_test_results.dart @@ -37,6 +37,18 @@ class _StockItemTestResultDisplayState extends RefreshableState L10().testResults; + @override + List getAppBarActions(BuildContext context) { + return [ + IconButton( + icon: FaIcon(FontAwesomeIcons.plusCircle), + onPressed: () { + addTestResult(context); + } + ), + ]; + } + @override Future request() async { await item.getTestTemplates(); @@ -220,14 +232,4 @@ class _StockItemTestResultDisplayState extends RefreshableState