forked from Shinonome/dots-hyprland
todo list proper anims
This commit is contained in:
@@ -26,27 +26,30 @@ Item {
|
|||||||
id: todoItem
|
id: todoItem
|
||||||
property bool pendingDoneToggle: false
|
property bool pendingDoneToggle: false
|
||||||
property bool pendingDelete: false
|
property bool pendingDelete: false
|
||||||
|
property bool enableHeightAnimation: false
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: todoItemRectangle.implicitHeight + todoListItemSpacing
|
implicitHeight: todoItemRectangle.implicitHeight + todoListItemSpacing
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
// Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
// NumberAnimation {
|
enabled: enableHeightAnimation
|
||||||
// duration: Appearance.animation.elementDecel.duration
|
NumberAnimation {
|
||||||
// easing.type: Appearance.animation.elementDecel.type
|
duration: Appearance.animation.elementDecelFast.duration
|
||||||
// }
|
easing.type: Appearance.animation.elementDecelFast.type
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function startAction() {
|
function startAction() {
|
||||||
|
enableHeightAnimation = true
|
||||||
todoItem.implicitHeight = 0
|
todoItem.implicitHeight = 0
|
||||||
actionTimer.start()
|
actionTimer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: actionTimer
|
id: actionTimer
|
||||||
interval: Appearance.animation.elementDecelFast.duration + ConfigOptions.hacks.arbitraryRaceConditionDelay
|
interval: Appearance.animation.elementDecelFast.duration
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (todoItem.pendingDelete) {
|
if (todoItem.pendingDelete) {
|
||||||
@@ -63,7 +66,7 @@ Item {
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
implicitHeight: todoContentRowLayout.implicitHeight + todoListItemPadding * 2
|
implicitHeight: todoContentRowLayout.implicitHeight
|
||||||
color: Appearance.colors.colLayer2
|
color: Appearance.colors.colLayer2
|
||||||
radius: Appearance.rounding.small
|
radius: Appearance.rounding.small
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
@@ -83,6 +86,7 @@ Item {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.leftMargin: 10
|
Layout.leftMargin: 10
|
||||||
Layout.rightMargin: 10
|
Layout.rightMargin: 10
|
||||||
|
Layout.bottomMargin: todoListItemPadding
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
@@ -92,8 +96,6 @@ Item {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
todoItem.pendingDoneToggle = true
|
todoItem.pendingDoneToggle = true
|
||||||
todoItem.startAction()
|
todoItem.startAction()
|
||||||
// if (!modelData.done) Todo.markDone(modelData.originalIndex)
|
|
||||||
// else Todo.markUnfinished(modelData.originalIndex)
|
|
||||||
}
|
}
|
||||||
contentItem: MaterialSymbol {
|
contentItem: MaterialSymbol {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
@@ -108,7 +110,6 @@ Item {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
todoItem.pendingDelete = true
|
todoItem.pendingDelete = true
|
||||||
todoItem.startAction()
|
todoItem.startAction()
|
||||||
// Todo.deleteItem(modelData.originalIndex)
|
|
||||||
}
|
}
|
||||||
contentItem: MaterialSymbol {
|
contentItem: MaterialSymbol {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|||||||
Reference in New Issue
Block a user