Hello everyone, Someone knows how to solve this p...
# compose
h
Hello everyone, Someone knows how to solve this preview problem??
k
What's the problem? seems that it renders the UI correctly
2
h
But it does not show the entire phone 🤔
I was expecting to be like this
z
It doesn't do that by default. I believe there's a flag you can pass to the preview annotation to enable system decorations.
😀 1
k
@Preview(showDecoration = true)
🙌 1
other options:
Copy code
val name: String = "",
    val group: String = "",
    @IntRange(from = 1) val apiLevel: Int = -1,
    val theme: String = "",
    // TODO(mount): Make this Dp when they are inline classes
    val widthDp: Int = -1,
    // TODO(mount): Make this Dp when they are inline classes
    val heightDp: Int = -1,
    val locale: String = "",
    @FloatRange(from = 0.01) val fontScale: Float = 1f,
    val showDecoration: Boolean = false,
    val showBackground: Boolean = false
h
Thank you guys \o/ That's it, I got it
a
Kinda think they should keep it square? Compose is to run on lots of different form factors and keeping the preview square will remind people to not think "phone only" ... just a thought🤔
2
c
I like the "storybook" effect where previews can show how to use components very nicely, I think only square preview views would would make that less nice. Maybe would be cool to allow for previews to specify a list of supported aspect ratios and allow developers to switch between them in preview though 😄
a
@caelum19 We are building SwiftUI for a piece of "display fabric" and it helped not thinking about a phone ... And XCode does exactly your idea, w*ith a "live preview"*. https://developer.apple.com/videos/play/wwdc2019/233/ Sure the Compose team will get there as they build out the tooling 🎉
c
As in it forces decorations to be on? ah I can see how that's not helpful