Add modifier for centering a view horizontally
This commit is contained in:
parent
5a625e31a7
commit
2ac37b3f9c
@ -14,4 +14,11 @@ extension View {
|
||||
.valign(.center)
|
||||
}
|
||||
|
||||
/// Wrap the view in a horizontal stack and center horizontally.
|
||||
/// - Returns: The view.
|
||||
public func horizontalCenter() -> View {
|
||||
HStack { self }
|
||||
.halign(.center)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ This is an overview of the available widgets and other components in _Adwaita_.
|
||||
| `insensitive(_:)` | Make a view unable to detect actions. This is especially useful for overlays. |
|
||||
| `onClick(handler:)` | Run a function when the user clicks on the widget. |
|
||||
| `verticalCenter()` | Wrap a view in a `VStack` and center vertically. |
|
||||
| `horizontalCenter()` | Wrap a view in an `HStack` and center horizontally. |
|
||||
|
||||
### `Button` Modifiers
|
||||
| Syntax | Description |
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user