I am having an android activity which has Base.Theme.AppCompat.Light.Dialog
as a theme on tablets and therefore is shown in a dialog.
When I used XML layouts I could set a min height with wrap content for the layout so it would
- Be at least x dp high when there was no or very little content.
- High as the content when the content was higher than the min height
- High as the screen when the content wouldnt fit inside the height of the screen, in that case I could scroll
Using a Jetpack Compose's Scaffold I am struggling recreating that behaviour. The dialog is alsways as high as the screen allows, even when there is no content.
I tried the following modifiers as a parameter to the scaffold:
Modifier.wrapContentHeight()
- the dialog is still as high as the screenModifier.defaultMinSize(minHeight = 250.dp)
- the dialog is still as high as the screenModifier.height(height = 250.dp)
- now it is smaller but it is fixed to that size, not growing when there is more contentModifier.requiredHeightIn(min = 250.dp, max = getMyScreenHeightinDp())
- the dialog is still as high as the screen
Since you can reduce the height of the scaffold with the .height(...)
modifier I think it should also be possible to recreate a wrap content behaviour. But how?