forked from aparoksha/adwaita-swift
Make spin row and switch row safer
This commit is contained in:
parent
2ac37b3f9c
commit
ead88864df
@ -85,7 +85,10 @@ public struct SpinRow: Widget {
|
|||||||
_ = row.addSuffix(suffixContent.view)
|
_ = row.addSuffix(suffixContent.view)
|
||||||
}
|
}
|
||||||
_ = row.onChange {
|
_ = row.onChange {
|
||||||
value = .init(row.getValue().rounded())
|
let value = Int(row.getValue().rounded())
|
||||||
|
if self.value != value {
|
||||||
|
self.value = value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
update(row: row)
|
update(row: row)
|
||||||
return .init(row, content: [prefixID: [prefixContent], suffixID: [suffixContent]])
|
return .init(row, content: [prefixID: [prefixContent], suffixID: [suffixContent]])
|
||||||
|
|||||||
@ -65,7 +65,9 @@ public struct SwitchRow: Widget {
|
|||||||
_ = row.addSuffix(suffixContent.view)
|
_ = row.addSuffix(suffixContent.view)
|
||||||
}
|
}
|
||||||
_ = row.onChange {
|
_ = row.onChange {
|
||||||
isOn = row.getActive()
|
if row.getActive() != isOn {
|
||||||
|
isOn = row.getActive()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
update(row: row)
|
update(row: row)
|
||||||
return .init(row, content: [prefixID: [prefixContent], suffixID: [suffixContent]])
|
return .init(row, content: [prefixID: [prefixContent], suffixID: [suffixContent]])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user