简体   繁体   中英

Increase the height / padding of the MenuBarExtra .menu button in SwiftUI

I've been frustrated for some time now trying to figure out how to increase the height of the button in the MenuBarExtra menu for a MacOS app. I've seen another app that has a larger height on these buttons, but I've been unable to replicate the same style nor have I found anything similar on the web.

This is what I have so far. Tried out applying different MenuBarExtraStyle to it, but what I need is a .menu style which is of a type PullDownMenuBarExtraStyle .

MenuBarExtra("Settings", systemImage: "hammer") {
     Button(action: {}) {
                HStack {
                    Image(systemName: "pawprint.fill")
                    Text("Small Button")
                }
            }
        }
        .menuBarExtraStyle(.menu)

If you switch to .menuBarExtraStyle(.window) you have full control over the display sizes and can build your own menu there.

        MenuBarExtra("Settings", systemImage: "hammer") {
            VStack {
                Button(action: {}) {
                    Label("Larger Button", systemImage: "pawprint.fill")
                    .font(.largeTitle)
                }
                .buttonStyle(.plain)
                .padding()
            }
        }
        .menuBarExtraStyle(.window)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM