From 2bdadc21403df91d798e369075fccf2a2a74061b Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 26 Jul 2021 17:28:16 +1000 Subject: [PATCH] Cleanup --- lib/api_form.dart | 14 +++++++++----- lib/barcode.dart | 3 +-- lib/inventree/model.dart | 4 +--- lib/inventree/stock.dart | 9 +-------- lib/widget/paginator.dart | 11 +++-------- pubspec.lock | 21 --------------------- 6 files changed, 15 insertions(+), 47 deletions(-) diff --git a/lib/api_form.dart b/lib/api_form.dart index 87876564..3c798e9e 100644 --- a/lib/api_form.dart +++ b/lib/api_form.dart @@ -1,3 +1,5 @@ +import 'dart:ui'; + import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:dropdown_search/dropdown_search.dart'; @@ -128,9 +130,6 @@ class APIFormField { results.add(result); } - print("Results:"); - print(results); - return results; } else { return []; @@ -140,11 +139,16 @@ class APIFormField { hint: helpText, onChanged: print, showClearButton: !required, + // popupTitle: Text( + // label, + // style: _labelStyle(), + // ), itemAsString: (dynamic item) { return item['pathstring']; }, isFilteredOnline: true, showSearchBox: true, + autoFocusSearchBox: true, compareFn: (dynamic item, dynamic selectedItem) { if (item == null || selectedItem == null) { @@ -198,7 +202,9 @@ class APIFormField { return new TextStyle( fontWeight: FontWeight.bold, fontSize: 18, + fontFamily: "arial", color: hasErrors() ? COLOR_DANGER : COLOR_GRAY, + fontStyle: FontStyle.normal, ); } @@ -246,8 +252,6 @@ Future launchApiForm(BuildContext context, String title, String url, Map(); - // Invalid response from server if (!options.isValid()) { return; diff --git a/lib/barcode.dart b/lib/barcode.dart index 7f361e9b..af7d5592 100644 --- a/lib/barcode.dart +++ b/lib/barcode.dart @@ -271,8 +271,7 @@ class StockItemBarcodeAssignmentHandler extends BarcodeHandler { final InvenTreeStockItem item; - StockItemBarcodeAssignmentHandler(this.item) { - } + StockItemBarcodeAssignmentHandler(this.item); @override String getOverlayText(BuildContext context) => L10().barcodeScanAssign; diff --git a/lib/inventree/model.dart b/lib/inventree/model.dart index 90f6d4ce..65e3f2e6 100644 --- a/lib/inventree/model.dart +++ b/lib/inventree/model.dart @@ -296,9 +296,7 @@ class InvenTreeModel { // Create a new object (of the current class type InvenTreeModel obj = createFromJson(d); - if (obj != null) { - results.add(obj); - } + results.add(obj); } return results; diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index 889ed4d4..cb1a524b 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -476,14 +476,7 @@ class InvenTreeStockItem extends InvenTreeModel { expectedStatusCode: 200 ); - print("Adjustment completed!"); - - if (response == null) { - return false; - } - - // Stock adjustment succeeded! - return true; + return response.isValid(); } Future countStock(BuildContext context, double q, {String? notes}) async { diff --git a/lib/widget/paginator.dart b/lib/widget/paginator.dart index 6ab9c337..84641330 100644 --- a/lib/widget/paginator.dart +++ b/lib/widget/paginator.dart @@ -21,19 +21,14 @@ class PaginatedSearchWidget extends StatelessWidget { leading: GestureDetector( child: FaIcon(controller.text.isEmpty ? FontAwesomeIcons.search : FontAwesomeIcons.backspace), onTap: () { - if (onChanged != null) { - controller.clear(); - onChanged(); - } + controller.clear(); + onChanged(); }, ), title: TextFormField( controller: controller, onChanged: (value) { - - if (onChanged != null) { - onChanged(); - } + onChanged(); }, decoration: InputDecoration( hintText: L10().search, diff --git a/pubspec.lock b/pubspec.lock index b06e4e40..e7d8e070 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -127,13 +127,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - dropdown_plus: - dependency: "direct main" - description: - name: dropdown_plus - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.9" dropdown_search: dependency: "direct main" description: @@ -162,13 +155,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.1.2" - find_dropdown: - dependency: "direct main" - description: - name: find_dropdown - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -511,13 +497,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.27.1" - select_dialog: - dependency: transitive - description: - name: select_dialog - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" sembast: dependency: "direct main" description: