MORE ANIMATION FIX AAAAAA

This commit is contained in:
end-4
2025-04-20 09:46:13 +02:00
parent b5a9e01455
commit 11ff4bbfaf
4 changed files with 209 additions and 145 deletions
@@ -38,6 +38,12 @@ Item {
destroyTimer0.start() destroyTimer0.start()
} }
function toggleExpanded() {
root.enableAnimation = true
notificationRowWrapper.anchors.bottom = undefined
root.expanded = !root.expanded
}
Timer { Timer {
id: destroyTimer0 id: destroyTimer0
interval: 0 interval: 0
@@ -83,7 +89,7 @@ Item {
if (mouse.button == Qt.MiddleButton) if (mouse.button == Qt.MiddleButton)
Notifications.discardNotification(notificationObject.id); Notifications.discardNotification(notificationObject.id);
else if (mouse.button == Qt.RightButton) else if (mouse.button == Qt.RightButton)
root.expanded = !root.expanded; root.toggleExpanded()
} }
} }
@@ -95,6 +101,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
// anchors.top: parent.top
anchors.topMargin: notificationListSpacing anchors.topMargin: notificationListSpacing
implicitHeight: notificationColumnLayout.implicitHeight + notificationListSpacing implicitHeight: notificationColumnLayout.implicitHeight + notificationListSpacing
@@ -103,6 +110,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
// anchors.top: parent.top
height: notificationColumnLayout.implicitHeight height: notificationColumnLayout.implicitHeight
color: (notificationObject.urgency == NotificationUrgency.Critical) ? color: (notificationObject.urgency == NotificationUrgency.Critical) ?
@@ -116,6 +124,13 @@ Item {
easing.type: Appearance.animation.elementDecel.type easing.type: Appearance.animation.elementDecel.type
} }
} }
Behavior on height {
enabled: enableAnimation
NumberAnimation {
duration: Appearance.animation.elementDecelFast.duration
easing.type: Appearance.animation.elementDecel.type
}
}
} }
} }
@@ -125,6 +140,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
// anchors.top: parent.top
implicitHeight: notificationColumnLayout.implicitHeight + notificationListSpacing implicitHeight: notificationColumnLayout.implicitHeight + notificationListSpacing
Behavior on x { Behavior on x {
@@ -140,10 +156,23 @@ 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
spacing: 0
Item {
Layout.fillWidth: true
implicitHeight: notificationRowLayout.implicitHeight
Behavior on implicitHeight {
enabled: enableAnimation
NumberAnimation {
duration: Appearance.animation.elementDecel.duration
easing.type: Appearance.animation.elementDecel.type
}
}
RowLayout { RowLayout {
id: notificationRowLayout id: notificationRowLayout
anchors.top: parent.top
Layout.fillWidth: true anchors.left: parent.left
anchors.right: parent.right
Rectangle { // App icon Rectangle { // App icon
id: iconRectangle id: iconRectangle
@@ -214,6 +243,7 @@ Item {
} }
} }
} }
ColumnLayout { // Notification content ColumnLayout { // Notification content
spacing: 0 spacing: 0
Layout.fillWidth: true Layout.fillWidth: true
@@ -261,8 +291,7 @@ Item {
PointingHandInteraction{} PointingHandInteraction{}
onClicked: { onClicked: {
root.enableAnimation = true root.toggleExpanded()
root.expanded = !root.expanded
} }
background: Rectangle { background: Rectangle {
@@ -305,7 +334,8 @@ Item {
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
color: Appearance.m3colors.m3outline color: Appearance.m3colors.m3outline
// textFormat: Text.MarkdownText // textFormat: Text.MarkdownText
text: notificationObject.body text: expanded ? notificationObject.body : notificationObject.body.split("\n")[0]
}
} }
} }
} }
@@ -314,18 +344,39 @@ Item {
Flickable { Flickable {
id: actionsFlickable id: actionsFlickable
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: -5 // Layout.topMargin: -5
Layout.leftMargin: 10 Layout.leftMargin: 10
Layout.rightMargin: 10 Layout.rightMargin: 10
Layout.bottomMargin: 10 Layout.bottomMargin: expanded ? 10 : 0
implicitHeight: actionRowLayout.implicitHeight implicitHeight: expanded ? actionRowLayout.implicitHeight : 0
height: expanded ? actionRowLayout.implicitHeight : 0
contentWidth: actionRowLayout.implicitWidth contentWidth: actionRowLayout.implicitWidth
clip: true clip: true
visible: expanded opacity: expanded ? 1 : 0
visible: opacity > 0
Behavior on opacity {
NumberAnimation {
duration: Appearance.animation.elementDecel.duration
easing.type: Appearance.animation.elementDecel.type
}
}
Behavior on height {
NumberAnimation {
duration: Appearance.animation.elementDecel.duration
easing.type: Appearance.animation.elementDecel.type
}
}
Behavior on implicitHeight {
NumberAnimation {
duration: Appearance.animation.elementDecel.duration
easing.type: Appearance.animation.elementDecel.type
}
}
RowLayout { RowLayout {
id: actionRowLayout id: actionRowLayout
Layout.alignment: Qt.AlignBottom
Repeater { Repeater {
id: actionRepeater id: actionRepeater
@@ -17,6 +17,17 @@ Rectangle {
property int currentTab: 0 property int currentTab: 0
property var tabButtonList: [{"icon": "notifications", "name": "Notifications"}, {"icon": "volume_up", "name": "Volume mixer"}] property var tabButtonList: [{"icon": "notifications", "name": "Notifications"}, {"icon": "volume_up", "name": "Volume mixer"}]
Keys.onPressed: (event) => {
if (event.key === Qt.Key_PageDown || event.key === Qt.Key_PageUp) {
if (event.key === Qt.Key_PageDown) {
root.currentTab = Math.min(root.currentTab + 1, root.tabButtonList.length - 1)
} else if (event.key === Qt.Key_PageUp) {
root.currentTab = Math.max(root.currentTab - 1, 0)
}
event.accepted = true;
}
}
ColumnLayout { ColumnLayout {
anchors.margins: 5 anchors.margins: 5
anchors.fill: parent anchors.fill: parent
@@ -75,7 +75,6 @@ Scope {
color: Appearance.colors.colLayer0 color: Appearance.colors.colLayer0
radius: Appearance.rounding.screenRounding - Appearance.sizes.elevationMargin + 1 radius: Appearance.rounding.screenRounding - Appearance.sizes.elevationMargin + 1
focus: true
Keys.onPressed: (event) => { Keys.onPressed: (event) => {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
sidebarRoot.visible = false; sidebarRoot.visible = false;
@@ -141,6 +140,7 @@ Scope {
// Center widget group // Center widget group
CenterWidgetGroup { CenterWidgetGroup {
focus: sidebarRoot.visible
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
@@ -79,8 +79,8 @@ Item {
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: Appearance.animation.elementDecel.duration duration: Appearance.animation.menuDecel.duration
easing.type: Appearance.animation.elementDecel.type easing.type: Appearance.animation.menuDecel.type
} }
} }
@@ -130,6 +130,8 @@ Item {
Item { Layout.fillWidth: true } Item { Layout.fillWidth: true }
NotificationStatusButton { NotificationStatusButton {
Layout.alignment: Qt.AlignVCenter
Layout.topMargin: 5
buttonIcon: "clear_all" buttonIcon: "clear_all"
buttonText: "Clear" buttonText: "Clear"
onClicked: () => { onClicked: () => {