From 56dd22c656ea75d0f088079e33318cc33d1d798f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 23 May 2020 21:15:02 +1000 Subject: [PATCH] Add some getters --- lib/inventree/part.dart | 12 ++++++++++++ lib/inventree/stock.dart | 14 ++++++++++++++ lib/widget/stock_item_test_results.dart | 14 +++++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/lib/inventree/part.dart b/lib/inventree/part.dart index d31b95c2..553535be 100644 --- a/lib/inventree/part.dart +++ b/lib/inventree/part.dart @@ -72,6 +72,18 @@ class InvenTreePartTestTemplate extends InvenTreeModel { @override String URL = "part/test-template/"; + String get key => jsondata['key'] ?? ''; + + String get testName => jsondata['test_name'] ?? ''; + + String get description => jsondata['description'] ?? ''; + + bool get required => jsondata['required'] ?? false; + + bool get requiresValue => jsondata['requires_value'] ?? false; + + bool get requiresAttachment => jsondata['requires_attachment'] ?? false; + InvenTreePartTestTemplate() : super(); InvenTreePartTestTemplate.fromJson(Map json) : super.fromJson(json) { diff --git a/lib/inventree/stock.dart b/lib/inventree/stock.dart index d48fb5a6..21598266 100644 --- a/lib/inventree/stock.dart +++ b/lib/inventree/stock.dart @@ -16,6 +16,20 @@ class InvenTreeStockItemTestResult extends InvenTreeModel { @override String URL = "stock/test/"; + String get key => jsondata['key'] ?? ''; + + String get test_name => jsondata['test'] ?? ''; + + bool get result => jsondata['result'] ?? false; + + String get value => jsondata['value'] ?? ''; + + String get notes => jsondata['notes'] ?? ''; + + String get attachment => jsondata['attachment'] ?? ''; + + String get date => jsondata['date'] ?? ''; + InvenTreeStockItemTestResult() : super(); InvenTreeStockItemTestResult.fromJson(Map json) : super.fromJson(json) { diff --git a/lib/widget/stock_item_test_results.dart b/lib/widget/stock_item_test_results.dart index 3d3c402a..d9a3ca1d 100644 --- a/lib/widget/stock_item_test_results.dart +++ b/lib/widget/stock_item_test_results.dart @@ -31,10 +31,22 @@ class _StockItemTestResultDisplayState extends RefreshableState resultsList() { + List items = []; + + items.add(ListTile( + title: Text("Test results"), + )); + + return items; + } + @override Widget getBody(BuildContext context) { return ListView( - + children: resultsList(), ); } } \ No newline at end of file