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