修复 FluPivot 的 header 选中项未高亮显示问题

This commit is contained in:
lucky9loogn 2024-11-25 09:50:05 +08:00
parent 8ab0cde2e9
commit d75ecfeca7
2 changed files with 18 additions and 8 deletions

View File

@ -5,8 +5,9 @@ import FluentUI 1.0
Page { Page {
default property alias content: d.children default property alias content: d.children
property alias currentIndex: nav_list.currentIndex property alias currentIndex: nav_list.currentIndex
property color textHighlightColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120 property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black property color textHoverColor: FluTheme.dark ? FluColors.Grey80 : FluColors.Grey150
property int textSpacing: 10 property int textSpacing: 10
property int headerSpacing: 20 property int headerSpacing: 20
property int headerHeight: 40 property int headerHeight: 40
@ -66,9 +67,13 @@ Page {
anchors.centerIn: parent anchors.centerIn: parent
font: control.font font: control.font
color: { color: {
if(item_button.hovered) if(nav_list.currentIndex === index) {
return textHoverColor return textHighlightColor;
return textNormalColor }
if (item_button.hovered) {
return textHoverColor;
}
return textNormalColor;
} }
} }
} }

View File

@ -6,8 +6,9 @@ import FluentUI
Page { Page {
default property alias content: d.children default property alias content: d.children
property alias currentIndex: nav_list.currentIndex property alias currentIndex: nav_list.currentIndex
property color textHighlightColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120 property color textNormalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
property color textHoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black property color textHoverColor: FluTheme.dark ? FluColors.Grey80 : FluColors.Grey150
property int textSpacing: 10 property int textSpacing: 10
property int headerSpacing: 20 property int headerSpacing: 20
property int headerHeight: 40 property int headerHeight: 40
@ -67,9 +68,13 @@ Page {
anchors.centerIn: parent anchors.centerIn: parent
font: control.font font: control.font
color: { color: {
if(item_button.hovered) if(nav_list.currentIndex === index) {
return textHoverColor return textHighlightColor;
return textNormalColor }
if (item_button.hovered) {
return textHoverColor;
}
return textNormalColor;
} }
} }
} }