mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-26 22:39:26 +00:00
fix: make toggle buttons great again
This commit is contained in:
parent
dbf34142e1
commit
9148be5718
@ -8,6 +8,7 @@ Switch {
|
|||||||
id: control
|
id: control
|
||||||
|
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
|
id: oval
|
||||||
implicitWidth: 52
|
implicitWidth: 52
|
||||||
implicitHeight: 28
|
implicitHeight: 28
|
||||||
x: control.leftPadding
|
x: control.leftPadding
|
||||||
@ -16,7 +17,7 @@ Switch {
|
|||||||
color: control.checked ? Style.current.blue : Style.current.grey
|
color: control.checked ? Style.current.blue : Style.current.grey
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
x: control.checked ? parent.width - width-4 : 4
|
id: circle
|
||||||
y: 4
|
y: 4
|
||||||
width: 20
|
width: 20
|
||||||
height: 20
|
height: 20
|
||||||
@ -32,6 +33,24 @@ Switch {
|
|||||||
cached: true
|
cached: true
|
||||||
color: "#22000000"
|
color: "#22000000"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "on"
|
||||||
|
when: control.checked
|
||||||
|
PropertyChanges { target: circle; x: oval.width - circle.width - 4 }
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "off"
|
||||||
|
when: !control.checked
|
||||||
|
PropertyChanges { target: circle; x: 4 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: Transition {
|
||||||
|
reversible: true
|
||||||
|
NumberAnimation { properties: "x"; easing.type: Easing.Linear; duration: 120; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user