Code fixes for alignment and StackItemModel conformance change.
This commit is contained in:
parent
d92c5b5679
commit
394a5aba18
@ -18,7 +18,6 @@ import Foundation
|
|||||||
// MARK: - MFViewProtocol
|
// MARK: - MFViewProtocol
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
styleTallDivider()
|
|
||||||
stack.updateView(size)
|
stack.updateView(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +41,14 @@ import Foundation
|
|||||||
centerHeadLineBody.setWithModel(model.centerHeadlineBody, delegateObject, additionalData)
|
centerHeadLineBody.setWithModel(model.centerHeadlineBody, delegateObject, additionalData)
|
||||||
rightHeadLineBody.setWithModel(model.rightHeadlineBody, delegateObject, additionalData)
|
rightHeadLineBody.setWithModel(model.rightHeadlineBody, delegateObject, additionalData)
|
||||||
|
|
||||||
// Create a stack model to use for the internal stack.
|
// Create a stack model to use for the internal stack and set the alignment of models
|
||||||
let stackModel = StackModel(molecules: [StackItemModel(percent: 33),StackItemModel(percent: 33),StackItemModel(percent: 33)])
|
let leftHeadlineBodyAlignment = StackItemModel(percent: 33)
|
||||||
stackModel.spacing = 0
|
leftHeadlineBodyAlignment.horizontalAlignment = .leading
|
||||||
|
let centerHeadLineBodyAlignment = StackItemModel(percent: 34)
|
||||||
|
centerHeadLineBodyAlignment.horizontalAlignment = .center
|
||||||
|
let rightHeadLineBodyAlignment = StackItemModel(percent: 33)
|
||||||
|
rightHeadLineBodyAlignment.horizontalAlignment = .trailing
|
||||||
|
let stackModel = StackModel(molecules: [leftHeadlineBodyAlignment,centerHeadLineBodyAlignment,rightHeadLineBodyAlignment])
|
||||||
stackModel.axis = .horizontal
|
stackModel.axis = .horizontal
|
||||||
stack.model = stackModel
|
stack.model = stackModel
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
|||||||
@ -23,6 +23,17 @@ public class ListThreeColumnPlanDataDividerModel: ContainerModel, ListItemModelP
|
|||||||
self.centerHeadlineBody = centerHeadlineBody
|
self.centerHeadlineBody = centerHeadlineBody
|
||||||
self.rightHeadlineBody = rightHeadlineBody
|
self.rightHeadlineBody = rightHeadlineBody
|
||||||
super.init()
|
super.init()
|
||||||
|
setDefaults()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Defaults to set
|
||||||
|
func setDefaults() {
|
||||||
|
if useHorizontalMargins == nil {
|
||||||
|
useHorizontalMargins = true
|
||||||
|
}
|
||||||
|
if useVerticalMargins == nil {
|
||||||
|
useVerticalMargins = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
@ -38,6 +49,7 @@ public class ListThreeColumnPlanDataDividerModel: ContainerModel, ListItemModelP
|
|||||||
centerHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .centerHeadlineBody)
|
centerHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .centerHeadlineBody)
|
||||||
rightHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .rightHeadlineBody)
|
rightHeadlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .rightHeadlineBody)
|
||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
|
setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func encode(to encoder: Encoder) throws {
|
public override func encode(to encoder: Encoder) throws {
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
@objcMembers public class StackItemModel: StackItemModelProtocol, MoleculeModelProtocol {
|
@objcMembers public class StackItemModel: ContainerModel, StackItemModelProtocol, MoleculeModelProtocol {
|
||||||
public static var identifier: String = "simpleStackItem"
|
public static var identifier: String = "simpleStackItem"
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var spacing: CGFloat?
|
public var spacing: CGFloat?
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user