notifs: add remove animation

This commit is contained in:
2 * r + 2 * t 2025-06-04 22:28:22 +10:00
parent 16c6fbdef3
commit 3925626117

View file

@ -20,7 +20,7 @@ Item {
if (count === 0)
return 0;
let height = (count - 1) * list.spacing;
let height = (count - 1) * Appearance.spacing.smaller;
for (let i = 0; i < count; i++)
height += list.itemAtIndex(i)?.nonAnimHeight ?? 0;
@ -61,19 +61,63 @@ Item {
anchors.fill: parent
orientation: Qt.Vertical
spacing: Appearance.spacing.smaller
spacing: 0
cacheBuffer: QsWindow.window?.screen.height ?? 0
delegate: ClippingRectangle {
delegate: Item {
id: wrapper
required property Notifs.Notif modelData
readonly property alias nonAnimHeight: notif.nonAnimHeight
implicitWidth: notif.implicitWidth
implicitHeight: notif.implicitHeight + Appearance.spacing.smaller
ListView.onRemove: removeAnim.start()
SequentialAnimation {
id: removeAnim
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: true
}
PropertyAction {
target: wrapper
property: "enabled"
value: false
}
PropertyAction {
target: wrapper
property: "implicitHeight"
value: 0
}
PropertyAction {
target: wrapper
property: "z"
value: 1
}
Anim {
target: notif
property: "x"
to: (notif.x >= 0 ? NotifsConfig.sizes.width : -NotifsConfig.sizes.width) * 2
duration: Appearance.anim.durations.normal
easing.bezierCurve: Appearance.anim.curves.emphasized
}
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: false
}
}
ClippingRectangle {
anchors.top: parent.top
color: "transparent"
radius: notif.radius
implicitWidth: notif.width
implicitHeight: notif.height
implicitWidth: notif.implicitWidth
implicitHeight: notif.implicitHeight
Notification {
id: notif
@ -81,6 +125,7 @@ Item {
modelData: wrapper.modelData
}
}
}
move: Transition {
Anim {