impr(ui): nav listview animation

This commit is contained in:
2025-11-08 21:40:47 +08:00
parent 4409986687
commit 7a3c186743

View File

@ -7,6 +7,10 @@ RowLayout {
id: layout id: layout
spacing: 5 spacing: 5
SystemPalette {
id: systemPalette
}
ListModel { ListModel {
id: navListModel id: navListModel
@ -35,6 +39,9 @@ RowLayout {
id: navListItem id: navListItem
required property int index required property int index
required property string label required property string label
property bool isActive: navListView.currentIndex === index
width: parent.width width: parent.width
height: 30 height: 30
@ -50,14 +57,29 @@ RowLayout {
anchors.fill: parent anchors.fill: parent
text: parent.label text: parent.label
color: parent.isActive ? systemPalette.highlightedText : systemPalette.text
z: 10
Behavior on color {
ColorAnimation {
duration: 150
}
} }
} }
highlight: Rectangle { Rectangle {
width: parent.width width: parent.isActive ? parent.width : 0
height: 30 Behavior on width {
color: "#FFFF88" NumberAnimation {
y: ListView.view.currentItem.y easing.type: Easing.OutQuad
duration: 200
}
}
height: parent.height
color: systemPalette.highlight
z: 1
}
} }
} }