what does it want? im using `maxWidth` which is fr...
# compose
u
what does it want? im using
maxWidth
which is from the box with constraints scope
s
I’m having the same issue. I believe this is a Lint bug. To silence it, just use this as a prefix to the properties it complains about.
this.maxWidth
👍 1
u
omg, thank you!
s
It's yelling at you to stop using BoxWithConstraints 😅
u
How else do I get a fraction of a screen ughh (chat message max width) but only up to a certain value (since tablets are big)
s
You can do smth like
Copy code
Modifier
 .fillMaxWidth()
 .wrapContentWidth()
 .fillMaxWidth(0.9f)
Play around with it a bit. We do this here https://github.com/HedvigInsurance/android/blob/develop/app%2Ffeature%2Ffeature-chat%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fhedvig%2Fandroid%2Ffeature%2Fchat%2FChatLoadedScreen.kt#L430-L434 for some chat messages that should take at most 80% of the available width. You skip a Subcomposition completely that way
u
but can you cap it to a dp value so its not 90% of say foldable width? i.e. too wide optically on such wide device?
btw semantically what does wrapContent and then fillMax mean actually?
s
yeah, can probably add in there a
.widthIn(max = 400.dp)
or something like that. This post https://blog.zachklipp.com/centering-in-compose/ will explain a lot of things much better than I ever could. I suggest you start there and see if it makes any more sense to you
👍 1
☝️ 1