Skip to content

Commit 7b2ec7c

Browse files
committed
feat: adjust notification center UI styling and layout
1. Changed crystal theme background color from pure white to light gray (240/255) for better visual comfort 2. Added text color handling for notification header using DStyle control selectColor 3. Reduced content padding from 20 to 10 and adjusted window margins for tighter layout 4. Removed left margin from content area and right margin from header 5. Updated blendColor function to use local blendColorAlpha instead of dock.blendColorAlpha 6. Modified blur background colors and opacity values for better visual integration 7. Added clipItems property to OverlapIndicator to control clipping behavior 8. Adjusted close button position in NotifyItemContent (rightMargin: -width/2 + 6) 9. Changed gradient background opacity from 1.0 to 0.5 for crystal theme 10. Reduced leftMargin in NotifyStyle from 20 to 10 11. Disabled drop shadow effect on DropShadowText for cleaner appearance Log: Improved notification center visual design with adjusted colors, spacing, and effects Influence: 1. Verify notification center appearance in both light and dark themes 2. Test overlapping notifications display with new clipping behavior 3. Check close button positioning in notification items 4. Verify window margins and padding in different screen configurations 5. Test notification header text color in various theme conditions 6. Validate blur effect and transparency in crystal theme 7. Check notification item background opacity in overlap mode feat: 调整通知中心UI样式和布局 1. 将水晶主题背景色从纯白色改为浅灰色(240/255),提升视觉舒适度 2. 为通知标题添加使用DStyle控制选择颜色的文本颜色处理 3. 将内容内边距从20减少到10,调整窗口边距实现更紧凑的布局 4. 移除内容区域的左边距和标题的右边距 5. 更新混合颜色函数使用本地blendColorAlpha替代dock.blendColorAlpha 6. 修改模糊背景颜色和透明度值以实现更好的视觉融合 7. 为重叠指示器添加clipItems属性以控制裁剪行为 8. 调整通知项内容中关闭按钮的位置(rightMargin: -width/2 + 6) 9. 将渐变背景透明度从1.0改为0.5(水晶主题) 10. 将NotifyStyle中的左边距从20减少到10 11. 禁用DropShadowText的阴影效果以获得更简洁的外观 Log: 优化通知中心视觉设计,调整颜色、间距和效果 Influence: 1. 验证通知中心在浅色和深色主题下的外观 2. 测试重叠通知显示与新裁剪行为 3. 检查通知项中关闭按钮的定位 4. 验证不同屏幕配置下的窗口边距和内边距 5. 测试各种主题条件下通知标题文本颜色 6. 验证水晶主题下的模糊效果和透明度 7. 检查重叠模式下通知项背景透明度
1 parent 201f6dc commit 7b2ec7c

10 files changed

Lines changed: 47 additions & 35 deletions

panels/notification/center/NormalNotify.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ NotifyItem {
6464
backgroundColor: Palette {
6565
normal {
6666
common: ("transparent")
67-
crystal: Qt.rgba(255 / 255.0, 255 / 255.0, 255 / 255.0, 0.7)
67+
crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 0.7)
6868
}
6969
normalDark {
7070
crystal: Qt.rgba(24 / 255.0, 24 / 255.0, 24 / 255.0, 0.7)

panels/notification/center/NotifyHeaderTitleText.qml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

55
import QtQuick
66
import Qt5Compat.GraphicalEffects
7-
import org.deepin.dtk 1.0
7+
import org.deepin.dtk 1.0
88
import org.deepin.ds.notification
99
import org.deepin.ds.notificationcenter
1010

1111
DropShadowText {
1212
property font tFont: DTK.fontManager.t4
13+
color: DTK.themeType === ApplicationHelper.DarkType ?
14+
Qt.rgba(255, 255, 255, 0.7) :
15+
Qt.rgba(0, 0, 0, 0.75)
1316
font {
1417
pixelSize: tFont.pixelSize
1518
family: tFont.family

panels/notification/center/OverlapNotify.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ NotifyItem {
125125
backgroundColor: Palette {
126126
normal {
127127
common: ("transparent")
128-
crystal: Qt.rgba(255 / 255.0, 255 / 255.0, 255 / 255.0, 0.7)
128+
crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 0.7)
129129
}
130130
normalDark {
131131
crystal: Qt.rgba(24 / 255.0, 24 / 255.0, 24 / 255.0, 0.7)
@@ -137,6 +137,7 @@ NotifyItem {
137137
OverlapIndicator {
138138
id: indicator
139139
enableAnimation: root.ListView.view.panelShown
140+
clipItems: true
140141
anchors {
141142
bottom: parent.bottom
142143
left: parent.left
@@ -147,6 +148,7 @@ NotifyItem {
147148
z: -1
148149
count: root.count
149150
background: NotifyItemBackground {
151+
opacity: realIndex === 0 ? 0.6 : 0.4
150152
backgroundColor: Palette {
151153
normal {
152154
common: ("transparent")

panels/notification/center/package/main.qml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Window {
6767
switch (position) {
6868
case 0: { // DOCK_TOP
6969
let visibleHeight = Math.max(0, dockGeometry.y + dockGeometry.height - screenGeometry.y)
70-
return Math.min(visibleHeight, dockGeometry.height)
70+
return Math.min(visibleHeight, dockGeometry.height)
7171
}
7272
case 1: { // DOCK_RIGHT
7373
let visibleWidth = Math.max(0, screenGeometry.x + screenGeometry.width - dockGeometry.x)
@@ -84,14 +84,14 @@ Window {
8484
visible: Panel.visible
8585
flags: Qt.Tool
8686

87-
property int contentPadding: 20
88-
width: NotifyStyle.contentItem.width + NotifyStyle.leftMargin +contentPadding * 2
87+
property int contentPadding: 10
88+
width: NotifyStyle.contentItem.width + contentPadding * 2
8989
// height: 800
9090
DLayerShellWindow.layer: DLayerShellWindow.LayerOverlay
9191
DLayerShellWindow.anchors: DLayerShellWindow.AnchorRight | DLayerShellWindow.AnchorTop | DLayerShellWindow.AnchorBottom
92-
DLayerShellWindow.topMargin: windowMargin(0)
93-
DLayerShellWindow.rightMargin: windowMargin(1)
94-
DLayerShellWindow.bottomMargin: windowMargin(2)
92+
DLayerShellWindow.topMargin: windowMargin(0) + contentPadding
93+
DLayerShellWindow.rightMargin: windowMargin(1) + contentPadding
94+
DLayerShellWindow.bottomMargin: windowMargin(2) + contentPadding
9595
DLayerShellWindow.exclusionZone: -1
9696
DLayerShellWindow.keyboardInteractivity: DLayerShellWindow.KeyboardInteractivityOnDemand
9797
palette: DTK.palette
@@ -103,6 +103,8 @@ Window {
103103
DWindow.enabled: true
104104
color: "transparent"
105105
DWindow.enableBlurWindow: true
106+
DWindow.borderColor: DTK.themeType === ApplicationHelper.DarkType ? Qt.rgba(0, 0, 0, 0.8) : Qt.rgba(0, 0, 0, 0.06)
107+
106108
// 修复:通知中心屏幕跟随任务栏屏幕,而不是硬编码为第一个屏幕
107109
screen: getDockScreen()
108110
// TODO `Qt.application.screens[0]` maybe invalid, why screen is changed.
@@ -135,17 +137,32 @@ Window {
135137
}
136138
}
137139

140+
141+
function blendColorAlpha(fallback) {
142+
var appearance = DS.applet("org.deepin.ds.dde-appearance")
143+
if (!appearance || appearance.opacity < 0)
144+
return fallback
145+
return appearance.opacity
146+
}
147+
138148
// only add blendColor effect when DWindow.enableBlurWindow is true,
139149
// avoid to updating blur area frequently.--
140150
StyledBehindWindowBlur {
151+
InsideBoxBorder {
152+
anchors.fill: parent
153+
radius: DTK.platformTheme.windowRadius
154+
color: DTK.themeType === ApplicationHelper.DarkType ?
155+
Qt.rgba(1, 1, 1, 0.1) :
156+
Qt.rgba(0, 0, 0, 0.1)
157+
}
141158
control: parent
142159
anchors.fill: parent
143160
cornerRadius: 0
144161
blendColor: {
145162
if (valid) {
146163
return DStyle.Style.control.selectColor(undefined,
147-
Qt.rgba(235 / 255.0, 235 / 255.0, 235 / 255.0, dock.blendColorAlpha(0.6)),
148-
Qt.rgba(10 / 255, 10 / 255, 10 /255, dock.blendColorAlpha(85 / 255)))
164+
Qt.rgba(238 / 255.0, 238 / 255.0, 238 / 255.0, blendColorAlpha(0.8)),
165+
Qt.rgba(20 / 255, 20 / 255, 20 /255, blendColorAlpha(0.8)))
149166
}
150167
return DStyle.Style.control.selectColor(undefined,
151168
DStyle.Style.behindWindowBlur.lightNoBlurColor,
@@ -161,7 +178,6 @@ Window {
161178
top: parent.top
162179
topMargin: contentPadding
163180
left: parent.left
164-
leftMargin: contentPadding
165181
right: parent.right
166182
bottom: parent.bottom
167183
}
@@ -172,7 +188,6 @@ Window {
172188
top: parent.top
173189
left: parent.left
174190
right: parent.right
175-
rightMargin: contentPadding
176191
}
177192
// Tab navigation: staging -> header
178193
onGotoHeaderFirst: notifyCenter.focusHeaderFirst()
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -9,11 +9,4 @@ import org.deepin.ds.notificationcenter
99

1010
Text {
1111
color: Qt.rgba(1, 1, 1, 1)
12-
layer.enabled: true
13-
layer.effect: DropShadow {
14-
color: Qt.rgba(0, 0, 0, 0.6)
15-
radius: 4
16-
samples: 9
17-
verticalOffset: 1
18-
}
1912
}

panels/notification/plugin/NotifyItemBackground.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Control {
1111

1212
padding: radius / 2
1313

14+
property int realIndex: 0
1415
property int radius: 12
1516
property Palette borderColor: Palette {
1617
normal {

panels/notification/plugin/NotifyItemContent.qml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ NotifyItem {
104104
top: parent.top
105105
topMargin: -height / 2
106106
right: parent.right
107-
rightMargin: -width / 2
107+
rightMargin: -width / 2 + 6
108108
}
109109
width: 20
110110
height: 20
@@ -149,12 +149,10 @@ NotifyItem {
149149
color1: Palette {
150150
normal {
151151
common: ("transparent")
152-
// TODO crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 0.5)
153-
crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 1.0)
152+
crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 0.5)
154153
}
155154
normalDark {
156-
// TODO crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 0.5)
157-
crystal: Qt.rgba(24 / 255.0, 24 / 255.0, 24 / 255.0, 1.0)
155+
crystal: Qt.rgba(24 / 255.0, 24 / 255.0, 24 / 255.0, 0.5)
158156
}
159157
}
160158
color2: color1

panels/notification/plugin/NotifyStyle.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -15,5 +15,5 @@ QtObject {
1515
property int width: 360
1616
}
1717
property int scrollBarPadding: 2
18-
property int leftMargin: 20
18+
property int leftMargin: 10
1919
}

panels/notification/plugin/OverlapIndicator.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Item {
1515
property int overlapHeight: 8
1616
property bool revert: false
1717
property bool enableAnimation: false
18+
property bool clipItems: false
1819

1920
implicitHeight: layout.height
2021
implicitWidth: 360
@@ -35,7 +36,7 @@ Item {
3536
Layout.preferredWidth: root.width - (realIndex) * radius * 2
3637
Layout.alignment: Qt.AlignHCenter
3738
z: -realIndex
38-
clip: true
39+
clip: root.clipItems
3940

4041
Loader {
4142
id: contentLoader
@@ -52,6 +53,7 @@ Item {
5253
sourceComponent: root.background
5354

5455
onLoaded: function() {
56+
contentLoader.item.realIndex = Qt.binding(function() { return item.realIndex; })
5557
if (root.enableAnimation) {
5658
fadeInAnimation.start()
5759
} else {

panels/notification/plugin/SettingActionButton.qml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -36,12 +36,10 @@ ActionButton {
3636
color1: Palette {
3737
normal {
3838
common: ("transparent")
39-
// TODO crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 0.5)
40-
crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 1.0)
39+
crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 0.5)
4140
}
4241
normalDark {
43-
// TODO crystal: Qt.rgba(240 / 255.0, 240 / 255.0, 240 / 255.0, 0.5)
44-
crystal: Qt.rgba(24 / 255.0, 24 / 255.0, 24 / 255.0, 1.0)
42+
crystal: Qt.rgba(24 / 255.0, 24 / 255.0, 24 / 255.0, 0.5)
4543
}
4644
}
4745

0 commit comments

Comments
 (0)