Vstack .max spacing doesn’t work #63

Closed
opened 2025-05-06 06:21:37 +02:00 by gnomeeee · 1 comment

Describe the bug

When i run something like:

VStack(spacing: .max) {
      Text(“hello”)
      Text(“world”)
}

I get error “value “-1” of type ‘gint’ is invalid or out of range for property ‘spacing’ of type ‘gint’”
Is this intended or a bug

Thanks!

To Reproduce

  1. Run
VStack(spacing: .max) {
      Text(“hello”)
      Text(“world”)
}
  1. Get error above

Expected behavior

.max spacing will move object to furtherest place

Additional context

No response

### Describe the bug When i run something like: ``` VStack(spacing: .max) { Text(“hello”) Text(“world”) } ``` I get error “value “-1” of type ‘gint’ is invalid or out of range for property ‘spacing’ of type ‘gint’” Is this intended or a bug Thanks! ### To Reproduce 1. Run ``` VStack(spacing: .max) { Text(“hello”) Text(“world”) } ``` 2. Get error above ### Expected behavior .max spacing will move object to furtherest place ### Additional context _No response_
gnomeeee added the
bug
label 2025-05-06 06:21:37 +02:00
Owner

That's not a bug.

If you want to increase the spacing between the items to a maximum, use vexpand(_:) and valign(_:) on the individual items.

This for example gives hello all the vertical space except for the vertical space used by world and aligns it to the top (inside this space):

VStack {
    Text("hello")
         .vexpand()
         .valign(.start)
     Text("world")
}
That's not a bug. If you want to increase the spacing between the items to a maximum, use [`vexpand(_:)`](https://adwaita-swift.aparoksha.dev/documentation/adwaita/anyview/vexpand(_:)/) and [`valign(_:)`](https://adwaita-swift.aparoksha.dev/documentation/adwaita/anyview/valign(_:)/) on the individual items. This for example gives `hello` all the vertical space except for the vertical space used by `world` and aligns it to the top (inside this space): ```swift VStack { Text("hello") .vexpand() .valign(.start) Text("world") } ```
Sign in to join this conversation.
No Milestone
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: aparoksha/adwaita-swift#63
No description provided.