This commit is contained in:
zhuzichu 2023-07-06 18:17:52 +08:00
parent ad4d077480
commit 80619f6974
5 changed files with 82 additions and 64 deletions

View File

@ -24,6 +24,7 @@ FluScrollablePage{
FluTextButton{ FluTextButton{
disabled:text_button_switch.checked disabled:text_button_switch.checked
text:"Text Button" text:"Text Button"
contentDescription: "文本按钮"
onClicked: { onClicked: {
showInfo("点击Text Button") showInfo("点击Text Button")
} }

View File

@ -168,7 +168,10 @@ CustomWindow {
width: parent.width width: parent.width
height: parent.height height: parent.height
z:999 z:999
//NoStack
// pageMode: FluNavigationView.NoStack // pageMode: FluNavigationView.NoStack
//StackpopFluPagelaunchMode
pageMode: FluNavigationView.NoStack
items: ItemsOriginal items: ItemsOriginal
footerItems:ItemsFooter footerItems:ItemsFooter
topPadding:FluTools.isMacos() ? 20 : 5 topPadding:FluTools.isMacos() ? 20 : 5

View File

@ -19,24 +19,41 @@ Item{
property string errorButtonText: "重新加载" property string errorButtonText: "重新加载"
property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1) property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
signal errorClicked signal errorClicked
property Component loadingItem : com_loading
property Component emptyItem : com_empty
property Component errorItem : com_error
Item{ Item{
id:container id:container
anchors.fill: parent anchors.fill: parent
visible: statusMode===FluStatusView.Success visible: statusMode===FluStatusView.Success
} }
Loader{
id:loader
anchors.fill: parent
visible: statusMode!==FluStatusView.Success
sourceComponent: {
if(statusMode === FluStatusView.Loading){
return loadingItem
}
if(statusMode === FluStatusView.Empty){
return emptyItem
}
if(statusMode === FluStatusView.Error){
return errorItem
}
return null
}
}
Component{
id:com_loading
FluArea{ FluArea{
paddings: 0 paddings: 0
border.width: 0 border.width: 0
anchors.fill: container radius: 0
visible: opacity
opacity: statusMode === FluStatusView.Loading
Behavior on opacity {
NumberAnimation { duration: 83 }
}
color:control.color color:control.color
ColumnLayout{ ColumnLayout{
anchors.centerIn: parent anchors.centerIn: parent
visible: statusMode === FluStatusView.Loading
FluProgressRing{ FluProgressRing{
indeterminate: true indeterminate: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -47,19 +64,16 @@ Item{
} }
} }
} }
}
Component {
id:com_empty
FluArea{ FluArea{
paddings: 0 paddings: 0
border.width: 0 border.width: 0
anchors.fill: container radius: 0
visible: opacity
color:control.color color:control.color
opacity: statusMode === FluStatusView.Empty
Behavior on opacity {
NumberAnimation { duration: 83 }
}
ColumnLayout{ ColumnLayout{
anchors.centerIn: parent anchors.centerIn: parent
visible: statusMode === FluStatusView.Empty
FluText{ FluText{
text:control.emptyText text:control.emptyText
font: FluTextStyle.BodyStrong font: FluTextStyle.BodyStrong
@ -67,16 +81,14 @@ Item{
} }
} }
} }
}
Component{
id:com_error
FluArea{ FluArea{
paddings: 0 paddings: 0
border.width: 0 border.width: 0
anchors.fill: container radius: 0
visible: opacity
color:control.color color:control.color
opacity: statusMode === FluStatusView.Error
Behavior on opacity {
NumberAnimation { duration: 83 }
}
ColumnLayout{ ColumnLayout{
anchors.centerIn: parent anchors.centerIn: parent
FluText{ FluText{
@ -94,6 +106,7 @@ Item{
} }
} }
} }
}
function showSuccessView(){ function showSuccessView(){
statusMode = FluStatusView.Success statusMode = FluStatusView.Success
} }

View File

@ -83,6 +83,7 @@ TextField{
right: parent.right right: parent.right
rightMargin: closeRightMargin rightMargin: closeRightMargin
} }
contentDescription:"清空"
onClicked:{ onClicked:{
control.text = "" control.text = ""
} }