Builder with nested Linear Layout? #844
-
|
I load this example YML code of my own making: LinearLayout:
orientation: horizontal
children:
- SelectView:
with:
- panel
items:
- "Lorem ipsum"
- "Dolor sit amet"
- "Consectetur adipiscing elit"
- DummyView:
- LinearLayout:
orientation: vertical
with:
- panel
children:
- Button:
label: Foobar
- Button:
label: Quit
callback: $Cursive.quitvia the builder pattern from examples (v0.21.1 with builder feature enabled). The second inner layout doesn't appear at all. With simpler example with just a button in the root layout, the button appears. There are no errors. Note Use of builder could be better documented, especially sections in docs.rs for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
|
Hi, and thanks for the report! I suspect the issue here is the ambiguity with yaml regarding list of objects. The child must have a single Here's what you should probably do instead: LinearLayout:
orientation: horizontal
children:
- SelectView:
with:
- panel
items:
- "Lorem ipsum"
- "Dolor sit amet"
- "Consectetur adipiscing elit"
- DummyView:
- LinearLayout:
orientation: vertical
with:
- panel
children:
- Button:
label: Foobar
- Button:
label: Quit
callback: $Cursive.quitI agree yaml can be very confusing for this specific case. In your example, it sees a Linear layout with an empty config, and ignores the rest of the keys. We should be able to error or warn when there's extra keys like this. |
Beta Was this translation helpful? Give feedback.
It looks like it's not happy about the button lacking a callback. Will check if it's optional, and if we can make it optional if not.