From 9e168d26c8a46a91fcbf628778dab106e26cce86 Mon Sep 17 00:00:00 2001 From: "Gu, Jiajun (external - Project)" Date: Tue, 12 Nov 2024 17:08:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20[IOSSDKBUG-455]=20Fil?= =?UTF-8?q?terFeedbackBar=20maxwidth=20customization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/SortFilter/FilterFeedbackBarItem+Style.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/FioriSwiftUICore/Views/SortFilter/FilterFeedbackBarItem+Style.swift b/Sources/FioriSwiftUICore/Views/SortFilter/FilterFeedbackBarItem+Style.swift index 31f69f85f..ce9ed86ab 100644 --- a/Sources/FioriSwiftUICore/Views/SortFilter/FilterFeedbackBarItem+Style.swift +++ b/Sources/FioriSwiftUICore/Views/SortFilter/FilterFeedbackBarItem+Style.swift @@ -46,9 +46,10 @@ public struct DefaultFilterFeedbackBarStyle: FilterFeedbackBarStyle { let padding: CGFloat let borderWidth: CGFloat let minHeight: CGFloat + let maxWidth: CGFloat /// :nodoc: - public init(font: Font = .system(.body), foregroundColorSelected: Color = DefaultFilterFeedbackBarForegroundColor, foregroundColorUnselected: Color = .preferredColor(.tertiaryLabel), fillColorSelected: Color = Color.clear, fillColorUnselected: Color = .preferredColor(.tertiaryFill), strokeColorSelected: Color = DefaultFilterFeedbackBarForegroundColor, strokeColorUnselected: Color = .preferredColor(.separator), cornerRadius: CGFloat = 10, spacing: CGFloat = 6, padding: CGFloat = 8, borderWidth: CGFloat = 1, minHeight: CGFloat = 38) { + public init(font: Font = .system(.body), foregroundColorSelected: Color = DefaultFilterFeedbackBarForegroundColor, foregroundColorUnselected: Color = .preferredColor(.tertiaryLabel), fillColorSelected: Color = Color.clear, fillColorUnselected: Color = .preferredColor(.tertiaryFill), strokeColorSelected: Color = DefaultFilterFeedbackBarForegroundColor, strokeColorUnselected: Color = .preferredColor(.separator), cornerRadius: CGFloat = 10, spacing: CGFloat = 6, padding: CGFloat = 8, borderWidth: CGFloat = 1, minHeight: CGFloat = 38, maxWidth: CGFloat = 0) { self.font = font self.foregroundColorSelected = foregroundColorSelected self.foregroundColorUnselected = foregroundColorUnselected @@ -61,6 +62,7 @@ public struct DefaultFilterFeedbackBarStyle: FilterFeedbackBarStyle { self.padding = padding self.borderWidth = borderWidth self.minHeight = minHeight + self.maxWidth = maxWidth } /// Build view according to configuration and style @@ -74,7 +76,7 @@ public struct DefaultFilterFeedbackBarStyle: FilterFeedbackBarStyle { .font(self.font) .foregroundColor(configuration.isSelected ? self.foregroundColorSelected : self.foregroundColorUnselected) .padding(self.padding) - .frame(minHeight: self.minHeight) + .frame(maxWidth: self.maxWidth > 0 ? self.maxWidth : nil, minHeight: self.minHeight) .background( ZStack { RoundedRectangle(cornerRadius: self.cornerRadius) @@ -110,8 +112,8 @@ public extension View { } /// Experimental filter feedback bar styling - func filterFeedbackBarStyle(font: Font = .system(.body), foregroundColorSelected: Color = .preferredColor(.tintColor), foregroundColorUnselected: Color = .preferredColor(.tertiaryLabel), fillColorSelected: Color = Color.clear, fillColorUnselected: Color = .preferredColor(.tertiaryFill), strokeColorSelected: Color = .preferredColor(.tintColor), strokeColorUnselected: Color = .preferredColor(.separator), cornerRadius: CGFloat = 10, spacing: CGFloat = 6, padding: CGFloat = 8, borderWidth: CGFloat = 1, minHeight: CGFloat = 38) -> some View { + func filterFeedbackBarStyle(font: Font = .system(.body), foregroundColorSelected: Color = .preferredColor(.tintColor), foregroundColorUnselected: Color = .preferredColor(.tertiaryLabel), fillColorSelected: Color = Color.clear, fillColorUnselected: Color = .preferredColor(.tertiaryFill), strokeColorSelected: Color = .preferredColor(.tintColor), strokeColorUnselected: Color = .preferredColor(.separator), cornerRadius: CGFloat = 10, spacing: CGFloat = 6, padding: CGFloat = 8, borderWidth: CGFloat = 1, minHeight: CGFloat = 38, maxWidth: CGFloat = 0) -> some View { self.environment(\.filterFeedbackBarStyle, - DefaultFilterFeedbackBarStyle(font: font, foregroundColorSelected: foregroundColorSelected, foregroundColorUnselected: foregroundColorUnselected, fillColorSelected: fillColorSelected, fillColorUnselected: fillColorUnselected, strokeColorSelected: strokeColorSelected, strokeColorUnselected: strokeColorUnselected, cornerRadius: cornerRadius, spacing: spacing, padding: padding, borderWidth: borderWidth, minHeight: minHeight)) + DefaultFilterFeedbackBarStyle(font: font, foregroundColorSelected: foregroundColorSelected, foregroundColorUnselected: foregroundColorUnselected, fillColorSelected: fillColorSelected, fillColorUnselected: fillColorUnselected, strokeColorSelected: strokeColorSelected, strokeColorUnselected: strokeColorUnselected, cornerRadius: cornerRadius, spacing: spacing, padding: padding, borderWidth: borderWidth, minHeight: minHeight, maxWidth: maxWidth)) } } From f70e24a3a14dee62bda0642b82c71f032801a8c9 Mon Sep 17 00:00:00 2001 From: "Gu, Jiajun (external - Project)" Date: Wed, 13 Nov 2024 08:59:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20[IOSSDKBUG-455]=20Fil?= =?UTF-8?q?terFeedbackBar=20maxwidth=20customization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FioriSwiftUICore/SortFilter/SortFilterExample.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apps/Examples/Examples/FioriSwiftUICore/SortFilter/SortFilterExample.swift b/Apps/Examples/Examples/FioriSwiftUICore/SortFilter/SortFilterExample.swift index 7f1e1cb7f..c60cae98f 100644 --- a/Apps/Examples/Examples/FioriSwiftUICore/SortFilter/SortFilterExample.swift +++ b/Apps/Examples/Examples/FioriSwiftUICore/SortFilter/SortFilterExample.swift @@ -37,7 +37,7 @@ struct SortFilterExample: View { VStack { if self.isCustomStyle { FilterFeedbackBar(items: self.$items, onUpdate: self.performSortAndFilter) - .filterFeedbackBarStyle(font: .subheadline, foregroundColorSelected: .red, strokeColorSelected: .red, cornerRadius: 25) + .filterFeedbackBarStyle(font: .subheadline, foregroundColorSelected: .red, strokeColorSelected: .red, cornerRadius: 25, maxWidth: 200) .optionListPickerStyle(font: .footnote, foregroundColorUnselected: .green, strokeColorSelected: .black) // .trailingFullConfigurationMenuItem(icon: "command") // .leadingFullConfigurationMenuItem(icon: "command")