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
highlight: Rectangle { Behavior on color {
width: parent.width ColorAnimation {
height: 30 duration: 150
color: "#FFFF88" }
y: ListView.view.currentItem.y }
}
Rectangle {
width: parent.isActive ? parent.width : 0
Behavior on width {
NumberAnimation {
easing.type: Easing.OutQuad
duration: 200
}
}
height: parent.height
color: systemPalette.highlight
z: 1
}
} }
} }