-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
I have been unable to get preferCenterAlignedStyle (and material3TopAppBar) to work. It seems to be ignored, always aligning the title (text or image) to the left.
.toolbar {
ToolbarItem(placement: .topBarLeading) {
// Left button here...
}
// Center logo - doesn't center on Android even with preferCenterAlignedStyle: true
ToolbarItem(placement: .principal) {
Image(systemName: "star.fill")
}
ToolbarItem(placement: .topBarTrailing) {
// Right button here...
}
}
As I understand it, these modifiers are unusual in SwiftUI in that they must be placed outside of the view they affect. I've applied this in a number of places, including at the app root, to no avail.
#if SKIP
.material3TopAppBar { options in
return options.copy(preferCenterAlignedStyle: true)
}
#endif
I have attached a screenshot and a simple code sample showing this behavior.
Metadata
Metadata
Assignees
Labels
No labels