import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.0
ApplicationWindow {
width: 300
height: 400
visible: true
ListView {
model: 10
anchors.fill: parent
delegate: SwipeDelegate {
id: delegate
text: index
width: parent.width
background.opacity: 0.5
swipe.left: Rectangle {
width: parent.width
height: parent.height
color: Material.color(Material.Green, SwipeDelegate.pressed ? Material.Shade700 : Material.Shade500)
Label {
text: "Left"
color: "white"
anchors.margins: 10
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
}
SwipeDelegate.onClicked: delegate.swipe.close()
}
swipe.right: Rectangle {
width: parent.width
height: parent.height
anchors.right: parent.right
color: Material.color(Material.Red, SwipeDelegate.pressed ? Material.Shade700 : Material.Shade500)
Label {
text: "Right"
color: "white"
anchors.margins: 10
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
}
SwipeDelegate.onClicked: delegate.swipe.close()
}
}
}
}