forked from aparoksha/adwaita-swift
Add modifier for centering a view horizontally
This commit is contained in:
parent
5a625e31a7
commit
2ac37b3f9c
@ -14,4 +14,11 @@ extension View {
|
|||||||
.valign(.center)
|
.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. |
|
| `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. |
|
| `onClick(handler:)` | Run a function when the user clicks on the widget. |
|
||||||
| `verticalCenter()` | Wrap a view in a `VStack` and center vertically. |
|
| `verticalCenter()` | Wrap a view in a `VStack` and center vertically. |
|
||||||
|
| `horizontalCenter()` | Wrap a view in an `HStack` and center horizontally. |
|
||||||
|
|
||||||
### `Button` Modifiers
|
### `Button` Modifiers
|
||||||
| Syntax | Description |
|
| Syntax | Description |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user