[FEAT] Pager height dependent on child height
Is your feature request related to a problem? Please describe. I want to create a screen with a pager, in which the pager only fills a portion of the screen. The height is dependent on the child heights. All children have the same height, which depends on the child's content. My screen is constructed like this:
VStack {
Spacer()
VStack {
Text("Some text")
Pager()
Text("Some more text")
}
}
What happens is that the outer VStack fills the while screen as the pager consumes the full available height. Even the Spacer() cannot force it to wrap the content height.
Describe the solution you'd like I would like to have an option where the pager is only as large as needed for the page content.
Describe alternatives you've considered
I played around with Spacers and the .frame() modifier, but Spacers don't work and the modifier is only a solution for static content height.
Hi @ln-12 , thanks for your feedback. Spacer takes up the available space but it always has less priority than any other view. This means that if Pager expands, Spacer won't ever push it unless you use init(minLenght:).
Unfortunately, Pager is not designed to work the way you describe. That would need a whole different implementation than the one used at the moment. As you mention, VStack (and also HStack) expands to fill the available space. This behavior is inherited by Pager whose top most view is a HStack