https://kotlinlang.org logo
#compose
Title
# compose
h

henrikhorbovyi

05/16/2020, 4:14 PM
Hello everyone, Someone knows how to solve this preview problem??
k

Kazemihabib1996

05/16/2020, 4:44 PM
What's the problem? seems that it renders the UI correctly
2
h

henrikhorbovyi

05/16/2020, 6:18 PM
But it does not show the entire phone 🤔
I was expecting to be like this
z

Zach Klippenstein (he/him) [MOD]

05/16/2020, 7:50 PM
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

Kazemihabib1996

05/16/2020, 7:59 PM
@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

henrikhorbovyi

05/16/2020, 10:57 PM
Thank you guys \o/ That's it, I got it
a

Ash

05/17/2020, 5:42 PM
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

caelum19

05/17/2020, 10:03 PM
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

Ash

05/17/2020, 10:11 PM
@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

caelum19

05/17/2020, 10:12 PM
As in it forces decorations to be on? ah I can see how that's not helpful
2 Views