mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Improve form spacing
This commit is contained in:
parent
29c92cd00e
commit
1896b71533
2 changed files with 18 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue