feat: add Address component that expands on click

This commit is contained in:
Jonathan Rainville 2020-08-27 13:28:31 -04:00 committed by Iuri Matias
parent 6fd4c363e7
commit 3a5285730e
4 changed files with 82 additions and 2 deletions

View File

@ -99,19 +99,20 @@ Item {
} }
RowLayout { RowLayout {
id: uiCatalong id: uiCatalog
anchors.top: networkTabSettings.bottom anchors.top: networkTabSettings.bottom
anchors.topMargin: 20 anchors.topMargin: 20
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 24 anchors.leftMargin: 24
Component.onCompleted: { Component.onCompleted: {
uiComponentBtn.enabled = false uiComponentBtn.enabled = true
} }
StyledText { StyledText {
//% "UI Components" //% "UI Components"
text: qsTrId("ui-components") text: qsTrId("ui-components")
} }
Switch { Switch {
checked: uiComponentBtn.enabled checked: uiComponentBtn.enabled
onCheckedChanged: function(value) { onCheckedChanged: function(value) {

View File

@ -14,6 +14,7 @@ Item {
ColumnLayout { ColumnLayout {
id: buttons id: buttons
spacing: 6 spacing: 6
width: parent.width
RowLayout { RowLayout {
Text { Text {
@ -134,5 +135,42 @@ Item {
state: "pending" state: "pending"
} }
} }
RowLayout {
width: parent.width
Layout.fillWidth: true
Item {
width: parent.width
height: addressComponent.height
Layout.fillWidth: true
Address {
id: addressComponent
text: "0x9ce0056c5fc6bb9459a4dcfa35eaad8c1fee5ce9"
width: 100
} }
} }
}
RowLayout {
width: parent.width
Layout.fillWidth: true
Item {
width: parent.width
height: addressComponent.height
Layout.fillWidth: true
Address {
id: addressComponentWidthAnchors
text: "0x9ce0056c5fc6bb9459a4dcfa35eaad8c1fee5ce9"
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: parent.width - 100
}
}
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;formeditorColor:"#ffffff";formeditorZoom:0.75;height:480;width:1000}
}
##^##*/

View File

@ -157,6 +157,7 @@ DISTFILES += \
app/AppLayouts/Profile/Sections/BackupSeedModal.qml \ app/AppLayouts/Profile/Sections/BackupSeedModal.qml \
app/AppLayouts/Profile/Sections/MyProfileContainer.qml \ app/AppLayouts/Profile/Sections/MyProfileContainer.qml \
app/AppLayouts/Profile/Sections/SoundsContainer.qml \ app/AppLayouts/Profile/Sections/SoundsContainer.qml \
app/AppLayouts/UIComponents/UIComponents.qml \
app/AppLayouts/Wallet/ReceiveModal.qml \ app/AppLayouts/Wallet/ReceiveModal.qml \
app/AppLayouts/Wallet/components/HeaderButton.qml \ app/AppLayouts/Wallet/components/HeaderButton.qml \
app/AppLayouts/Profile/Sections/Data/locales.js \ app/AppLayouts/Profile/Sections/Data/locales.js \
@ -329,6 +330,7 @@ DISTFILES += \
onboarding/qmldir \ onboarding/qmldir \
shared/AccountSelector.qml \ shared/AccountSelector.qml \
shared/AddButton.qml \ shared/AddButton.qml \
shared/Address.qml \
shared/IconButton.qml \ shared/IconButton.qml \
shared/Input.qml \ shared/Input.qml \
shared/LabelValueRow.qml \ shared/LabelValueRow.qml \

39
ui/shared/Address.qml Normal file
View File

@ -0,0 +1,39 @@
import QtQuick 2.13
import "../imports"
StyledText {
property bool expanded: false
property int oldWidth
id: addressComponent
text: "0x9ce0056c5fc6bb9459a4dcfa35eaad8c1fee5ce9"
font.pixelSize: 13
font.family: Style.current.fontHexRegular.name
elide: expanded ? Text.ElideNone : Text.ElideMiddle
color: Style.current.darkGrey
MouseArea {
width: parent.width
height: parent.height
cursorShape: Qt.PointingHandCursor
onClicked: {
if (addressComponent.expanded) {
addressComponent.width = addressComponent.oldWidth
this.width = addressComponent.width
} else {
this.width = addressComponent.implicitWidth
addressComponent.oldWidth = addressComponent.width
addressComponent.width = addressComponent.implicitWidth
}
addressComponent.expanded = !addressComponent.expanded
}
}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff"}
}
##^##*/