Skip to content

Commit 7832432

Browse files
committed
qml: Add Skeleton loading animation to WalletBadge
1 parent 6cf1621 commit 7832432

File tree

2 files changed

+68
-31
lines changed

2 files changed

+68
-31
lines changed

src/qml/pages/wallet/DesktopWallets.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Page {
2929
implicitHeight: 46
3030
text: walletController.selectedWallet.name
3131
balance: walletController.selectedWallet.balance
32+
loading: !walletController.initialized
3233

3334
MouseArea {
3435
anchors.fill: parent

src/qml/pages/wallet/WalletBadge.qml

Lines changed: 67 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Button {
2222
property bool showBalance: true
2323
property bool showIcon: true
2424
property string balance: "0.0 000 000"
25+
property bool loading: false
2526

2627
checkable: true
2728
hoverEnabled: AppMode.isDesktop
@@ -31,39 +32,74 @@ Button {
3132
topPadding: 0
3233
clip: true
3334

34-
contentItem: RowLayout {
35-
anchors.leftMargin: 5
36-
anchors.rightMargin: 5
37-
clip: true
38-
spacing: 5
39-
Icon {
40-
id: icon
41-
visible: root.showIcon
42-
source: "image://images/singlesig-wallet"
43-
color: Theme.color.neutral8
44-
size: 30
45-
Layout.minimumWidth: 30
46-
Layout.preferredWidth: 30
47-
Layout.maximumWidth: 30
48-
}
49-
ColumnLayout {
50-
spacing: 2
51-
CoreText {
52-
horizontalAlignment: Text.AlignLeft
35+
contentItem: Item {
36+
anchors.fill: parent
37+
38+
RowLayout {
39+
visible: root.loading
40+
anchors.leftMargin: 5
41+
anchors.rightMargin: 5
42+
anchors.centerIn: parent
43+
spacing: 5
44+
45+
Skeleton {
46+
Layout.preferredHeight: 30
47+
Layout.preferredWidth: 30
48+
}
49+
ColumnLayout {
50+
spacing: 2
51+
Layout.preferredHeight: 30
5352
Layout.fillWidth: true
54-
wrap: false
55-
id: buttonText
56-
font.pixelSize: 13
57-
text: root.text
58-
color: root.textColor
59-
bold: true
60-
visible: root.text !== ""
53+
54+
Skeleton {
55+
Layout.preferredHeight: 15
56+
Layout.preferredWidth: 50
57+
}
58+
59+
Skeleton {
60+
Layout.preferredHeight: 15
61+
Layout.preferredWidth: 114
62+
}
63+
}
64+
}
65+
66+
RowLayout {
67+
visible: !root.loading
68+
69+
anchors.leftMargin: 5
70+
anchors.rightMargin: 5
71+
anchors.centerIn: parent
72+
clip: true
73+
spacing: 5
74+
Icon {
75+
id: icon
76+
visible: root.showIcon
77+
source: "image://images/singlesig-wallet"
78+
color: Theme.color.neutral8
79+
size: 30
80+
Layout.minimumWidth: 30
81+
Layout.preferredWidth: 30
82+
Layout.maximumWidth: 30
6183
}
62-
CoreText {
63-
id: balanceText
64-
visible: root.showBalance
65-
text: "" + root.balance
66-
color: Theme.color.neutral7
84+
ColumnLayout {
85+
spacing: 2
86+
CoreText {
87+
horizontalAlignment: Text.AlignLeft
88+
Layout.fillWidth: true
89+
wrap: false
90+
id: buttonText
91+
font.pixelSize: 13
92+
text: root.text
93+
color: root.textColor
94+
bold: true
95+
visible: root.text !== ""
96+
}
97+
CoreText {
98+
id: balanceText
99+
visible: root.showBalance
100+
text: "" + root.balance
101+
color: Theme.color.neutral7
102+
}
67103
}
68104
}
69105
}

0 commit comments

Comments
 (0)