updated to allow FormSection Title

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-06-15 20:30:25 -05:00
parent ab5d88b4d8
commit e9af0b721c
2 changed files with 48 additions and 11 deletions

View File

@ -11,6 +11,19 @@ import Combine
import VDS
public class FormSection: UIStackView {
public var title: String? {
didSet {
if let title {
titleLabel.text = title
titleLabel.isHidden = false
} else {
titleLabel.isHidden = true
}
}
}
private var titleLabel = Label().with { $0.isHidden = true; $0.textStyle = .boldBodyLarge }
public override init(frame: CGRect) {
super.init(frame: frame)
translatesAutoresizingMaskIntoConstraints = false
@ -18,6 +31,7 @@ public class FormSection: UIStackView {
distribution = .fill
axis = .vertical
spacing = 10
addArrangedSubview(titleLabel)
}
public convenience init() {

View File

@ -76,6 +76,19 @@ class DropShadowViewController: BaseViewController<View> {
override func viewDidLoad() {
super.viewDidLoad()
let label1 = Label().with { $0.text = "View 1"; $0.textAlignment = .center}
let label2 = Label().with { $0.text = "View 2"; $0.textAlignment = .center}
let label3 = Label().with { $0.text = "View 3"; $0.textAlignment = .center}
component.addSubview(label1)
label1.pinToSuperView()
secondView.addSubview(label2)
label2.pinToSuperView()
thirdView.addSubview(label3)
label3.pinToSuperView()
let wrapper = UIView.makeWrapperWithConstraints(for: component, isTrailing: false)
componentWrapper = wrapper.view
componentConstraints = wrapper.container
@ -117,19 +130,29 @@ class DropShadowViewController: BaseViewController<View> {
override func setupForm(){
super.setupForm()
formStackView.title = "Screen Settings"
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Space Between Views", view: viewSpacerRange)
addFormRow(label: "View Padding", view: viewPaddingRange)
addFormRow(label: "View Corner Radius", view: viewRadiusRange)
addFormRow(label: "View Light", view: viewLightColorPickerSelectorView)
addFormRow(label: "View Dark", view: viewDarkColorPickerSelectorView)
addFormRow(label: "Shawdow Light", view: dropShadowLightColorPickerSelectorView)
addFormRow(label: "Shawdow Dark", view: dropShadowDarkColorPickerSelectorView)
addFormRow(label: "Space Between 1,2,3", view: viewSpacerRange)
addFormRow(label: "Opacity", view: opacityRange)
addFormRow(label: "Radius (Blur)", view: radiusRange)
addFormRow(label: "Width (OffSet X)", view: offsetXRange)
addFormRow(label: "Height (Offset Y)", view: offsetYRange)
let form1 = FormSection()
form1.title = "View 1 Settings"
form1.addFormRow(label: "All ", view: viewPaddingRange)
form1.addFormRow(label: "Padding", view: viewPaddingRange)
form1.addFormRow(label: "Corner Radius", view: viewRadiusRange)
form1.addFormRow(label: "Light", view: viewLightColorPickerSelectorView)
form1.addFormRow(label: "Dark", view: viewDarkColorPickerSelectorView)
let form2 = FormSection()
form2.title = "View 1 Shadow Settings"
form2.addFormRow(label: "Shawdow Light", view: dropShadowLightColorPickerSelectorView)
form2.addFormRow(label: "Shawdow Dark", view: dropShadowDarkColorPickerSelectorView)
form2.addFormRow(label: "Opacity", view: opacityRange)
form2.addFormRow(label: "Radius (Blur)", view: radiusRange)
form2.addFormRow(label: "Width (OffSet X)", view: offsetXRange)
form2.addFormRow(label: "Height (Offset Y)", view: offsetYRange)
append(section: form1)
append(section: form2)
opacityRange.maximumValue = 1.0
opacityRange.minimumValue = 0.0