forked from Shinonome/dots-hyprland
sidebar: add scroll to bottom button
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import qs.services
|
||||
import qs.modules.common
|
||||
import qs.modules.common.widgets
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
RippleButton {
|
||||
id: root
|
||||
required property ListView target
|
||||
|
||||
anchors {
|
||||
bottom: parent.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottomMargin: 10
|
||||
}
|
||||
|
||||
opacity: !target.atYEnd ? 1 : 0
|
||||
scale: !target.atYEnd ? 1 : 0.7
|
||||
visible: opacity > 0
|
||||
Behavior on opacity {
|
||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||
}
|
||||
Behavior on scale {
|
||||
animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
|
||||
}
|
||||
|
||||
implicitWidth: contentItem.implicitWidth + 8 * 2
|
||||
implicitHeight: contentItem.implicitHeight + 4 * 2
|
||||
|
||||
colBackground: Appearance.colors.colSecondary
|
||||
colBackgroundHover: Appearance.colors.colSecondaryHover
|
||||
colRipple: Appearance.colors.colSecondaryActive
|
||||
buttonRadius: Appearance.rounding.verysmall
|
||||
|
||||
downAction: () => {
|
||||
target.positionViewAtEnd()
|
||||
}
|
||||
|
||||
contentItem: Row {
|
||||
id: contentItem
|
||||
spacing: 4
|
||||
MaterialSymbol {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "arrow_downward"
|
||||
font.pixelSize: Appearance.font.pixelSize.larger
|
||||
color: Appearance.colors.colOnSecondary
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
StyledText {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: Translation.tr("Scroll to Bottom")
|
||||
font.pixelSize: Appearance.font.pixelSize.smallie
|
||||
color: Appearance.colors.colOnSecondary
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user