Warning, /plasma-mobile/spacebar/src/contents/ui/FloatingActionButton.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls as Controls
0009 import QtQuick.Layouts
0010 import Qt5Compat.GraphicalEffects
0011 import org.kde.kirigami as Kirigami
0012 
0013 // floating round button for mobile actions
0014 Item {
0015     id: root
0016     property string iconName
0017     signal clicked()
0018     
0019     RectangularGlow {
0020         anchors.fill: button
0021         anchors.topMargin: 5
0022         cornerRadius: button.radius * 2
0023         cached: true
0024         glowRadius: 4
0025         spread: 0.8
0026         color: Qt.darker(Kirigami.Theme.backgroundColor, 1.2)
0027     }
0028 
0029     Rectangle {
0030         id: button
0031         anchors.horizontalCenter: parent.horizontalCenter
0032         anchors.bottom: parent.bottom
0033         anchors.bottomMargin: Kirigami.Units.largeSpacing
0034         
0035         implicitWidth: Kirigami.Units.gridUnit * 3
0036         implicitHeight: Kirigami.Units.gridUnit * 3
0037         radius: width / 2
0038         color: Kirigami.Theme.highlightColor
0039         
0040         Controls.AbstractButton {
0041             anchors.fill: parent
0042             onPressedChanged: {
0043                 if (pressed) {
0044                     parent.color = Qt.darker(Kirigami.Theme.highlightColor, 1.1)
0045                 } else {
0046                     parent.color = Kirigami.Theme.highlightColor
0047                 }
0048             }
0049             onClicked: root.clicked()
0050         }
0051         
0052         Kirigami.Icon {
0053             anchors.centerIn: parent
0054             source: root.iconName
0055             Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
0056             Kirigami.Theme.inherit: false
0057             isMask: true
0058             implicitWidth: Kirigami.Units.iconSizes.smallMedium
0059             implicitHeight: Kirigami.Units.iconSizes.smallMedium
0060         }
0061     }
0062 }