mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Creates modifier for customInsetGrouped rows
This commit is contained in:
@@ -16,19 +16,12 @@ struct TimelineCustomizerView: View {
|
||||
var body: some View {
|
||||
List {
|
||||
Section(header: Text("Icon Size", comment: "Timline Customiser: Icon size section header")) {
|
||||
|
||||
ZStack {
|
||||
TickMarkSliderView(minValue: 1, maxValue: 3, currentValue: Binding(get: {
|
||||
Float(appDefaults.timelineIconSize.rawValue)
|
||||
}, set: { AppDefaults.shared.timelineIconSize = IconSize(rawValue: Int($0))! }))
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 8)
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 15, bottom: 0, trailing: 15))
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.foregroundColor(Color(uiColor: UIColor.secondarySystemGroupedBackground))
|
||||
)
|
||||
.customInsetGroupedRowStyle()
|
||||
}
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 30, bottom: 0, trailing: 30))
|
||||
.listRowBackground(Color.clear)
|
||||
@@ -40,13 +33,7 @@ struct TimelineCustomizerView: View {
|
||||
Float(appDefaults.timelineNumberOfLines)
|
||||
}, set: { appDefaults.timelineNumberOfLines = Int($0) }))
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 8)
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 15, bottom: 0, trailing: 15))
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.foregroundColor(Color(uiColor: UIColor.secondarySystemGroupedBackground))
|
||||
)
|
||||
.customInsetGroupedRowStyle()
|
||||
}
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 30, bottom: 0, trailing: 30))
|
||||
.listRowBackground(Color.clear)
|
||||
|
||||
34
iOS/SwiftUI Extensions/CustomInsetGroupedRowStyle.swift
Normal file
34
iOS/SwiftUI Extensions/CustomInsetGroupedRowStyle.swift
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// CustomInsetGroupedRowStyle.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 22/12/2022.
|
||||
// Copyright © 2022 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CustomInsetGroupedRowStyle: ViewModifier {
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 8)
|
||||
.listRowInsets(EdgeInsets(top: 0, leading: 15, bottom: 0, trailing: 15))
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.foregroundColor(Color(uiColor: UIColor.secondarySystemGroupedBackground))
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension View {
|
||||
|
||||
/// This function dismisses a view when the user launches from
|
||||
/// an external action, for example, opening the app from the widget.
|
||||
/// - Returns: `View`
|
||||
func customInsetGroupedRowStyle() -> some View {
|
||||
modifier(CustomInsetGroupedRowStyle())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user