fix: fix token list having a space when using the filter

This commit is contained in:
Jonathan Rainville 2020-06-18 12:38:35 -04:00 committed by Iuri Matias
parent 5c63adb0ad
commit 810831e41e
2 changed files with 23 additions and 24 deletions

View File

@ -18,49 +18,37 @@ Item {
ListView { ListView {
anchors.top: searchBox.bottom anchors.top: searchBox.bottom
anchors.topMargin: 10
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
spacing: 10 spacing: 0
id: tokenListView id: tokenListView
anchors.topMargin: Theme.smallPadding
model: Tokens {} model: Tokens {}
ScrollBar.vertical: ScrollBar { active: true } ScrollBar.vertical: ScrollBar { active: true }
delegate: Component { delegate: Component {
id: component
Item { Item {
id: element id: tokenContainer
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 10 anchors.leftMargin: Theme.smallPadding
width: parent.width width: parent.width
property bool isVisible: searchBox.text == "" || symbol.toLowerCase().includes(searchBox.text.toLowerCase()) property bool isVisible: symbol && (searchBox.text == "" || name.toLowerCase().includes(searchBox.text.toLowerCase()) || symbol.toLowerCase().includes(searchBox.text.toLowerCase()))
// property bool isVisible: index % 2 === 0
// property bool isVisible: searchBox.text == "" || name.toLowerCase().includes(searchBox.text.toLowerCase()) || symbol.toLowerCase().includes(searchBox.text.toLowerCase())
visible: isVisible
visible: isVisible && symbol !== "" ? true : false height: isVisible ? 40 + Theme.smallPadding : 0
height: isVisible && symbol !== "" ? 40 : 0
Image { Image {
id: assetInfoImage id: assetInfoImage
width: 36 width: 36
height: isVisible && symbol !== "" ? 36 : 0 height: tokenContainer.isVisible !== "" ? 36 : 0
anchors.top: parent.top
anchors.topMargin: 0
source: hasIcon ? "../../../img/tokens/" + symbol + ".png" : "../../../img/tokens/0-native.png" source: hasIcon ? "../../../img/tokens/" + symbol + ".png" : "../../../img/tokens/0-native.png"
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter
}
Text {
id: assetFullTokenName
text: name + " -- " + index
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.left: assetInfoImage.right
anchors.leftMargin: Theme.smallPadding
color: Theme.darkGrey
font.pixelSize: 15
} }
Text { Text {
id: assetSymbol id: assetSymbol
@ -72,11 +60,21 @@ Item {
color: Theme.black color: Theme.black
font.pixelSize: 15 font.pixelSize: 15
} }
Text {
id: assetFullTokenName
text: name
anchors.bottom: assetInfoImage.bottom
anchors.bottomMargin: 0
anchors.left: assetInfoImage.right
anchors.leftMargin: Theme.smallPadding
color: Theme.darkGrey
font.pixelSize: 15
}
CheckBox { CheckBox {
id: assetCheck id: assetCheck
checked: walletModel.hasAsset("0x123", symbol) checked: walletModel.hasAsset("0x123", symbol)
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 10 anchors.rightMargin: Theme.smallPadding
onClicked: walletModel.toggleAsset(symbol, assetCheck.checked, address, name, decimals, "eeeeee") onClicked: walletModel.toggleAsset(symbol, assetCheck.checked, address, name, decimals, "eeeeee")
} }
} }

View File

@ -157,6 +157,7 @@ Item {
anchors.left: receiveBtn.right anchors.left: receiveBtn.right
anchors.leftMargin: walletMenu.btnOuterMargin anchors.leftMargin: walletMenu.btnOuterMargin
width: settingsImg.width width: settingsImg.width
height: settingsImg.height
Image { Image {
id: settingsImg id: settingsImg
width: 18 width: 18