Add scroll to bottom FAB.

This commit is contained in:
Black Hat
2018-07-09 13:36:28 +08:00
parent 6bd059ce63
commit 0b2ae33f29
3 changed files with 56 additions and 10 deletions

View File

@@ -144,8 +144,37 @@ Item {
ScrollBar.vertical: ScrollBar { /*anchors.left: messageListView.right*/ }
onAtYBeginningChanged: {
if(currentRoom && atYBeginning) currentRoom.getPreviousContent(50)
Behavior on contentY {
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
}
RoundButton {
id: goTopFab
width: height
height: !parent.atYEnd ? 64 : 0
anchors.verticalCenter: parent.bottom
anchors.verticalCenterOffset: -48
anchors.horizontalCenter: parent.right
anchors.horizontalCenterOffset: -48
contentItem: MaterialIcon {
anchors.fill: parent
icon: "\ue313"
color: "white"
}
opacity: hovered ? 1 : 0.5
Material.background: Qt.lighter(Material.accent)
onClicked: parent.positionViewAtBeginning()
Behavior on height {
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
}
Behavior on opacity {
PropertyAnimation { easing.type: Easing.InOutCubic; duration: 200 }
}
}
}