Skip to content

Add ContinueButton interaction color animation states #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/qml/controls/ContinueButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15

Button {
id: root
font.family: "Inter"
font.styleName: "Semi Bold"
font.pixelSize: 18
Expand All @@ -17,9 +18,47 @@ Button {
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
id: bg
implicitHeight: 46
implicitWidth: 300
color: Theme.color.orange
radius: 5
state:"DEFAULT"

states: [
State {
name: "DEFAULT"
PropertyChanges { target: bg; color: Theme.color.orange }
},
State {
name: "HOVER"
PropertyChanges { target: bg; color: Theme.color.orangeLight1 }
},
State {
name: "PRESSED"
PropertyChanges { target: bg; color: Theme.color.orangeLight2 }
}
]

Behavior on color {
ColorAnimation { duration: 150 }
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
root.background.state = "HOVER"
}
onExited: {
root.background.state = "DEFAULT"
}
onPressed: {
root.background.state = "PRESSED"
}
onReleased: {
root.background.state = "DEFAULT"
root.clicked()
}
}
}
6 changes: 6 additions & 0 deletions src/qml/controls/Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Control {
required property color white
required property color background
required property color orange
required property color orangeLight1
required property color orangeLight2
required property color red
required property color green
required property color blue
Expand Down Expand Up @@ -38,6 +40,8 @@ Control {
white: "#FFFFFF"
background: "black"
orange: "#F89B2A"
orangeLight1: "#FFAD4A"
orangeLight2: "#FFBF72"
red: "#EC6363"
green: "#36B46B"
blue: "#3CA3DE"
Expand All @@ -59,6 +63,8 @@ Control {
white: "#FFFFFF"
background: "white"
orange: "#F7931A"
orangeLight1: "#FFAD4A"
orangeLight2: "#FFBF72"
red: "#EB5757"
green: "#27AE60"
blue: "#2D9CDB"
Expand Down