visionOS: Improve button appearance in Compose attachment list

This commit is contained in:
Shadowfacts 2023-10-20 11:23:29 -04:00
parent 27dd8a1927
commit 978486bc15
1 changed files with 14 additions and 2 deletions

View File

@ -131,9 +131,9 @@ class AttachmentsListController: ViewController {
@Environment(\.horizontalSizeClass) private var horizontalSizeClass @Environment(\.horizontalSizeClass) private var horizontalSizeClass
var body: some View { var body: some View {
attachmentsList
Group { Group {
attachmentsList
if controller.parent.config.presentAssetPicker != nil { if controller.parent.config.presentAssetPicker != nil {
addImageButton addImageButton
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2)) .listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
@ -147,6 +147,10 @@ class AttachmentsListController: ViewController {
togglePollButton togglePollButton
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2)) .listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
} }
#if os(visionOS)
.buttonStyle(.bordered)
.labelStyle(AttachmentButtonLabelStyle())
#endif
} }
private var attachmentsList: some View { private var attachmentsList: some View {
@ -246,3 +250,11 @@ fileprivate struct SheetOrPopover<V: View>: ViewModifier {
} }
} }
} }
@available(visionOS 1.0, *)
fileprivate struct AttachmentButtonLabelStyle: LabelStyle {
func makeBody(configuration: Configuration) -> some View {
DefaultLabelStyle().makeBody(configuration: configuration)
.foregroundStyle(.white)
}
}