feat: improve sidebar notif expand anim

No layout so no shifting from pixel alignment
Also remove top/bottom margins (were causing some weird position
glitches)
This commit is contained in:
2 * r + 2 * t 2026-04-20 00:27:05 +10:00
parent fffe6f4943
commit b004edad7d
2 changed files with 11 additions and 13 deletions

View file

@ -52,7 +52,7 @@ StyledRect {
readonly property int nonAnimHeight: { readonly property int nonAnimHeight: {
const headerHeight = header.implicitHeight + (root.expanded ? Math.round(Tokens.spacing.small / 2) : 0); const headerHeight = header.implicitHeight + (root.expanded ? Math.round(Tokens.spacing.small / 2) : 0);
const columnHeight = headerHeight + notifList.layoutHeight + column.Layout.topMargin + column.Layout.bottomMargin; const columnHeight = headerHeight + notifList.layoutHeight;
return Math.round(Math.max(TokenConfig.sizes.notifs.image, columnHeight) + Tokens.padding.normal * 2); return Math.round(Math.max(TokenConfig.sizes.notifs.image, columnHeight) + Tokens.padding.normal * 2);
} }
readonly property bool expanded: props.expandedNotifs.includes(modelData) readonly property bool expanded: props.expandedNotifs.includes(modelData)
@ -172,19 +172,21 @@ StyledRect {
} }
} }
ColumnLayout { Column {
id: column id: column
Layout.topMargin: -Tokens.padding.small
Layout.bottomMargin: -Tokens.padding.small / 2
Layout.fillWidth: true Layout.fillWidth: true
spacing: 0 spacing: root.expanded ? Math.round(Tokens.spacing.small / 2) : 0
Behavior on spacing {
Anim {}
}
RowLayout { RowLayout {
id: header id: header
Layout.bottomMargin: root.expanded ? Math.round(Tokens.spacing.small / 2) : 0 anchors.left: parent.left
Layout.fillWidth: true anchors.right: parent.right
spacing: Tokens.spacing.smaller spacing: Tokens.spacing.smaller
StyledText { StyledText {
@ -251,10 +253,6 @@ StyledRect {
} }
} }
} }
Behavior on Layout.bottomMargin {
Anim {}
}
} }
NotifGroupList { NotifGroupList {

View file

@ -1,7 +1,6 @@
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Layouts
import Quickshell import Quickshell
import Caelestia.Components import Caelestia.Components
import Caelestia.Config import Caelestia.Config
@ -19,7 +18,8 @@ LazyListView {
signal requestToggleExpand(expand: bool) signal requestToggleExpand(expand: bool)
Layout.fillWidth: true anchors.left: parent.left
anchors.right: parent.right
implicitHeight: contentHeight implicitHeight: contentHeight
spacing: Math.round(Tokens.spacing.small / 2) spacing: Math.round(Tokens.spacing.small / 2)