status-desktop/ui/app/AppLayouts/Wallet/AssetsTab.qml

107 lines
3.3 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.14
2020-05-28 15:38:00 +00:00
import "../../../imports"
import "../../../shared"
2020-05-28 14:54:42 +00:00
Item {
height: assetListView.height
2020-05-28 14:54:42 +00:00
Component {
id: assetViewDelegate
Item {
2020-05-28 15:38:00 +00:00
id: element
2020-05-28 14:54:42 +00:00
anchors.right: parent.right
anchors.left: parent.left
2020-05-28 15:38:00 +00:00
height: 40
2020-05-28 14:54:42 +00:00
Image {
id: assetInfoImage
width: 36
height: 36
2020-07-22 20:46:28 +00:00
source: symbol ? "../../img/tokens/" + symbol + ".png" : ""
2020-05-28 14:54:42 +00:00
anchors.left: parent.left
2020-05-28 15:38:00 +00:00
anchors.leftMargin: 0
2020-05-28 14:54:42 +00:00
anchors.verticalCenter: parent.verticalCenter
onStatusChanged: {
if (assetInfoImage.status == Image.Error) {
assetInfoImage.source = "../../img/tokens/DEFAULT-TOKEN@3x.png"
}
}
2020-05-28 14:54:42 +00:00
}
StyledText {
2020-05-28 14:54:42 +00:00
id: assetSymbol
text: symbol
2020-05-28 15:38:00 +00:00
anchors.left: assetInfoImage.right
anchors.leftMargin: Style.current.smallPadding
2020-05-28 15:38:00 +00:00
anchors.top: assetInfoImage.top
anchors.topMargin: 0
font.pixelSize: 15
}
StyledText {
2020-05-28 15:38:00 +00:00
id: assetFullTokenName
text: name
2020-05-28 15:38:00 +00:00
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.left: assetInfoImage.right
anchors.leftMargin: Style.current.smallPadding
color: Style.current.secondaryText
2020-05-28 15:38:00 +00:00
font.pixelSize: 15
}
StyledText {
2020-05-28 15:38:00 +00:00
id: assetValue
text: value.toUpperCase() + " " + symbol
2020-05-28 15:38:00 +00:00
anchors.right: parent.right
anchors.rightMargin: 0
font.pixelSize: 15
font.strikeout: false
2020-05-28 14:54:42 +00:00
}
StyledText {
2020-05-28 14:54:42 +00:00
id: assetFiatValue
color: Style.current.secondaryText
text: Utils.toLocaleString(fiatBalance, globalSettings.locale) + " " + walletModel.defaultCurrency.toUpperCase()
2020-05-28 14:54:42 +00:00
anchors.right: parent.right
2020-05-28 15:38:00 +00:00
anchors.rightMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
font.pixelSize: 15
2020-05-28 14:54:42 +00:00
}
}
}
2020-05-28 15:38:00 +00:00
ListModel {
id: exampleModel
ListElement {
value: "123 USD"
symbol: "ETH"
fullTokenName: "Ethereum"
fiatBalanceDisplay: "3423 ETH"
2020-05-28 15:38:00 +00:00
image: "../../img/token-icons/eth.svg"
}
}
2020-05-28 14:54:42 +00:00
ScrollView {
2020-05-28 14:54:42 +00:00
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: assetListView.contentHeight > assetListView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
ListView {
id: assetListView
spacing: Style.current.padding * 2
anchors.fill: parent
// model: exampleModel
model: walletModel.assets
delegate: assetViewDelegate
boundsBehavior: Flickable.StopAtBounds
}
2020-05-28 14:54:42 +00:00
}
}
/*##^##
Designer {
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
}
##^##*/