2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-15 11:45:31 +00:00

Stock display (#379)

* Display stock quantity more prominently

* Cleanup search widget

* Update for stock_detail widget

* More tweaks

* Change bottom bar icon

* Display boolean parameters appropriately

* Adds ability to edit part parameters

* Bump icon size a bit

* Improvements to filter options

- Allow filtering by "option" type
- To start with, filter stock by status code

* Remove debug message

* Remove getTriState method

- No longer needed
- Remove associated unit tests

* Adjust filters based on server API version

* Muted colors
This commit is contained in:
Oliver
2023-06-24 11:34:42 +10:00
committed by GitHub
parent 8076887e39
commit e9eb84eace
20 changed files with 278 additions and 167 deletions

View File

@ -275,6 +275,7 @@ class APIFormField {
// Construct a widget for this input
Widget constructField(BuildContext context) {
switch (type) {
case "string":
case "url":
@ -696,6 +697,14 @@ class APIFormField {
// Construct a string input element
Widget _constructString() {
if (readOnly) {
return ListTile(
title: Text(label),
subtitle: Text(helpText),
trailing: Text(value.toString()),
);
}
return TextFormField(
decoration: InputDecoration(
labelText: required ? label + "*" : label,
@ -724,12 +733,21 @@ class APIFormField {
// Construct a boolean input element
Widget _constructBoolean() {
bool? initial_value;
if (value is bool || value == null) {
initial_value = value as bool?;
} else {
String vs = value.toString().toLowerCase();
initial_value = ["1", "true", "yes"].contains(vs);
}
return CheckBoxField(
label: label,
labelStyle: _labelStyle(),
helperText: helpText,
helperStyle: _helperStyle(),
initial: value as bool?,
initial: initial_value,
tristate: (getParameter("tristate") ?? false) as bool,
onSaved: (val) {
data["value"] = val;
@ -1262,6 +1280,10 @@ class _APIFormWidgetState extends State<APIFormWidget> {
for (var field in widget.fields) {
if (field.readOnly) {
continue;
}
if (field.isSimple) {
// Simple top-level field data
data[field.name] = field.data["value"];