2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

Improve form spacing

This commit is contained in:
Oliver
2021-08-16 11:15:59 +10:00
parent 29c92cd00e
commit 1896b71533
2 changed files with 18 additions and 2 deletions

View File

@ -616,6 +616,8 @@ class _APIFormWidgetState extends State<APIFormWidget> {
_APIFormWidgetState(this.title, this.url, this.fields, this.method, this.onSuccess) : super();
bool spacerRequired = false;
List<Widget> _buildForm() {
List<Widget> widgets = [];
@ -626,6 +628,18 @@ class _APIFormWidgetState extends State<APIFormWidget> {
continue;
}
// Add divider before some widgets
if (spacerRequired) {
switch (field.type) {
case "related field":
case "choice":
widgets.add(Divider(height: 15));
break;
default:
break;
}
}
widgets.add(field.constructField());
if (field.hasErrors()) {
@ -649,9 +663,11 @@ class _APIFormWidgetState extends State<APIFormWidget> {
switch (field.type) {
case "related field":
case "choice":
widgets.add(Divider(height: 10));
widgets.add(Divider(height: 15));
spacerRequired = false;
break;
default:
spacerRequired = true;
break;
}