Add option for gap
This commit is contained in:
parent
40146ebfdb
commit
4170728900
@ -28,8 +28,8 @@ public struct Window: WinUISceneElement {
|
||||
var width: Meta.Binding<Int>?
|
||||
/// The window's height.
|
||||
var height: Meta.Binding<Int>?
|
||||
/// Add a custom title.
|
||||
var customTitle = false
|
||||
/// Add a custom gap.
|
||||
var gap = false
|
||||
|
||||
/// Create a window type with a certain identifier and user interface.
|
||||
/// - Parameters:
|
||||
@ -52,17 +52,15 @@ public struct Window: WinUISceneElement {
|
||||
if extendContent ?? false {
|
||||
ModifierWrapper(
|
||||
view: Grid(columns: [.init()]) {
|
||||
if customTitle {
|
||||
ModifierWrapper(
|
||||
view: Text(title)
|
||||
.style(.caption),
|
||||
verticalAlignment: .center
|
||||
)
|
||||
}
|
||||
ModifierWrapper(
|
||||
view: Text(title)
|
||||
.style(.caption),
|
||||
verticalAlignment: .center
|
||||
)
|
||||
}
|
||||
.titleBar(),
|
||||
height: customTitle ? 48 : 16,
|
||||
margin: (48, 0, 0, 0),
|
||||
height: 48,
|
||||
margin: (gap ? 48 : 0, 0, 0, 0),
|
||||
verticalAlignment: .top
|
||||
)
|
||||
}
|
||||
@ -149,12 +147,12 @@ public struct Window: WinUISceneElement {
|
||||
/// Whether to extend the content into the title bar.
|
||||
/// - Parameters:
|
||||
/// - enabled: Whether to extend the content.
|
||||
/// - showTitle: Whether to add a custom title overlay.
|
||||
/// - gap: Whether to insert a gap for the navigation view's main button.
|
||||
/// - Returns: The window.
|
||||
public func extendContentIntoTitleBar(_ enabled: Bool? = true, showTitle: Bool = true) -> Self {
|
||||
public func extendContentIntoTitleBar(_ enabled: Bool? = true, gap: Bool = false) -> Self {
|
||||
var newSelf = self
|
||||
newSelf.extendContent = enabled
|
||||
newSelf.customTitle = showTitle
|
||||
newSelf.gap = gap
|
||||
return newSelf
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ struct Demo: App {
|
||||
Window("Demo", id: "main") { _ in
|
||||
ContentView(app: app)
|
||||
}
|
||||
.extendContentIntoTitleBar()
|
||||
.extendContentIntoTitleBar(gap: true)
|
||||
.frame(width: $width, height: $height)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user