sidebar/notifs: better expand/close anim
This commit is contained in:
parent
3b492d7fae
commit
688cc213ef
1 changed files with 19 additions and 2 deletions
|
|
@ -26,18 +26,35 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property int spacing: Math.round(Appearance.spacing.small / 2)
|
readonly property int spacing: Math.round(Appearance.spacing.small / 2)
|
||||||
|
property bool showAllNotifs
|
||||||
property bool flag
|
property bool flag
|
||||||
|
|
||||||
signal requestToggleExpand(expand: bool)
|
signal requestToggleExpand(expand: bool)
|
||||||
|
|
||||||
|
onExpandedChanged: {
|
||||||
|
if (expanded) {
|
||||||
|
clearTimer.stop();
|
||||||
|
showAllNotifs = true;
|
||||||
|
} else {
|
||||||
|
clearTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
implicitHeight: nonAnimHeight
|
implicitHeight: nonAnimHeight
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: clearTimer
|
||||||
|
|
||||||
|
interval: Appearance.anim.durations.normal
|
||||||
|
onTriggered: root.showAllNotifs = false
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: repeater
|
id: repeater
|
||||||
|
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: root.expanded ? root.notifs : root.notifs.slice(0, Config.notifs.groupPreviewNum + 1)
|
values: root.showAllNotifs ? root.notifs : root.notifs.slice(0, Config.notifs.groupPreviewNum + 1)
|
||||||
onValuesChanged: root.flagChanged()
|
onValuesChanged: root.flagChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +137,7 @@ Item {
|
||||||
Component.onDestruction: modelData.unlock(this)
|
Component.onDestruction: modelData.unlock(this)
|
||||||
|
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
running: !notif.previewHidden
|
Component.onCompleted: running = !notif.previewHidden
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
target: notif
|
target: notif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue