Nick
08/04/2024, 12:58 AMNorris
08/04/2024, 1:37 AMNorris
08/04/2024, 2:22 AMNick
08/04/2024, 2:27 AMNorris
08/04/2024, 7:08 AMNorris
08/04/2024, 7:08 AMNick
08/04/2024, 7:55 AMview {
+ Label(…) // <- notice +
}
your views also need to have a size (default is Size.Empty
). so you have to set an explicit size or bounds on most. or assign a layout to their container that will give them a size.
display += view {
bounds = Rectangle(…)
}
// or, using a layout like the constraint based one
display.layout = constrain(display.first()) {
it.width eq 100
it.height eq 50
it.center eq parent.center
}
you also need to use a behavior
for many of the components in the Controls library. see the docs for more details: https://nacular.github.io/doodle/docs/troubleshooting/gotchas. this is for flexibility. many components have no default rendering and defer entirely to a behavior
which gives more control. that said, you can use one of the built-in Themes to provide behaviors automatically: https://nacular.github.io/doodle/docs/themes.Norris
08/04/2024, 1:25 PMNorris
08/04/2024, 2:46 PMNorris
08/04/2024, 2:50 PMTextMetrics
, but did not figure out how to create a concrete implementation of it. It’s just being injected everywhere.Nick
08/04/2024, 3:12 PMcommonMain
. so you can inject the interface in a commonMain
class and add bind to the concrete impl in jsMain
, wasJsMain
, etc.
TextMeteics
is a type that is bound automatically for you (like Display
) and can just be injected into your app.Nick
08/04/2024, 3:23 PMBasicTheme
will install a behavior for Labels, or you could do the same by creating a new CommonLabelBehabior
directly and installing it on your Label like it does.
https://nacular.github.io/doodle-api/themes/io.nacular.doodle.theme.basic/-basic-theme/-companion/basic-label-behavior