fix(StatusBaseButton): Button component should keep its original width/size when it enters loading state

fixes #656
This commit is contained in:
Khushboo Mehta 2022-05-09 14:02:02 +02:00 committed by r4bbit.eth
parent 5def2102c7
commit b4ebc520e1
1 changed files with 14 additions and 12 deletions

View File

@ -105,6 +105,17 @@ Rectangle {
hoverEnabled: !loading hoverEnabled: !loading
enabled: !loading enabled: !loading
Loader {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
active: loading
sourceComponent: StatusLoadingIndicator {
color: statusBaseButton.enabled ? textColor
: disabledTextColor
} // Indicator
} // Loader
Row { Row {
id: layout id: layout
anchors.left: parent.left anchors.left: parent.left
@ -117,29 +128,20 @@ Rectangle {
height: statusBaseButton.icon.height height: statusBaseButton.icon.height
icon: statusBaseButton.icon.name icon: statusBaseButton.icon.name
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: !loading && statusBaseButton.icon.name !== "" opacity: !loading && statusBaseButton.icon.name !== ""
visible: statusBaseButton.icon.name !== ""
color: statusBaseButton.enabled ? textColor color: statusBaseButton.enabled ? textColor
: disabledTextColor : disabledTextColor
} // Icon } // Icon
StatusBaseText { StatusBaseText {
id: label id: label
visible: !loading opacity: !loading
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
font.pixelSize: size === StatusBaseButton.Size.Large ? 15 : 13 // by design font.pixelSize: size === StatusBaseButton.Size.Large ? 15 : 13 // by design
color: statusBaseButton.enabled ? textColor color: statusBaseButton.enabled ? textColor
: disabledTextColor : disabledTextColor
} // Text } // Text
Loader {
anchors.verticalCenter: parent.verticalCenter
active: loading
visible: loading
sourceComponent: StatusLoadingIndicator {
color: statusBaseButton.enabled ? textColor
: disabledTextColor
} // Indicator
} // Loader
} // Ro } // Ro