Commit f7ba4c9e by Orkhan Alikhanov

Added state-aware pulse coloring for Radio and CheckButton

parent 6a22d0ec
...@@ -20,6 +20,7 @@ open class BaseIconLayerButton: Button { ...@@ -20,6 +20,7 @@ open class BaseIconLayerButton: Button {
open override var isSelected: Bool { open override var isSelected: Bool {
didSet { didSet {
iconLayer.setSelected(isSelected, animated: false) iconLayer.setSelected(isSelected, animated: false)
updatePulseColor()
} }
} }
...@@ -150,6 +151,10 @@ open class BaseIconLayerButton: Button { ...@@ -150,6 +151,10 @@ open class BaseIconLayerButton: Button {
setIconColor(theme.secondary, for: .selected) setIconColor(theme.secondary, for: .selected)
setIconColor(theme.onSurface.withAlphaComponent(0.38), for: .normal) setIconColor(theme.onSurface.withAlphaComponent(0.38), for: .normal)
titleColor = theme.onSurface.withAlphaComponent(0.60) titleColor = theme.onSurface.withAlphaComponent(0.60)
selectedPulseColor = theme.secondary
normalPulseColor = theme.onSurface
updatePulseColor()
} }
...@@ -168,6 +173,18 @@ open class BaseIconLayerButton: Button { ...@@ -168,6 +173,18 @@ open class BaseIconLayerButton: Button {
UIGraphicsEndImageContext() UIGraphicsEndImageContext()
self.image = image self.image = image
} }
/// Pulse color for selected state.
open var selectedPulseColor = Color.white
/// Pulse color for normal state.
open var normalPulseColor = Color.white
}
private extension BaseIconLayerButton {
func updatePulseColor() {
pulseColor = isSelected ? selectedPulseColor : normalPulseColor
}
} }
// MARK: - BaseIconLayer // MARK: - BaseIconLayer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment