增加修复了深色模式,完全沉浸的深色模式完成了。

Signed-off-by: laoyang <laoyang@example.com>
This commit is contained in:
laoyang
2026-09-16 21:40:11 +08:00
parent 353473127a
commit d7c49db304
10 changed files with 182 additions and 29 deletions
@@ -247,6 +247,9 @@ struct AccountsPage {
}
.width('100%')
.height('100%')
// 沉浸式:背景延伸到状态栏/导航条区域(只扩绘制、不移动子组件)
.backgroundColor($r('app.color.page_bg'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
@Builder
@@ -292,6 +292,8 @@ struct AddAccountPage {
.height('100%')
.padding({ left: 24, right: 24, top: 16, bottom: 24 })
.backgroundColor($r('app.color.page_bg'))
// 沉浸式:背景延伸到状态栏/导航条区域(只扩绘制、不移动子组件)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.alignItems(HorizontalAlign.Center)
}
@@ -310,6 +312,10 @@ struct AddAccountPage {
.fontSize(15)
.backgroundColor($r('app.color.input_bg'))
.borderRadius(8)
// 显式指定文字/提示/光标颜色:默认取系统主题色,深色模式下会与底色撞色而"看不清"
.fontColor($r('app.color.text_primary'))
.placeholderColor($r('app.color.text_hint'))
.caretColor($r('app.color.brand'))
.onChange(onChange)
}
.alignItems(HorizontalAlign.Start)
@@ -249,6 +249,7 @@ struct CalendarListPage {
.fontSize(16)
.fontColor($r('app.color.text_primary'))
.placeholderColor($r('app.color.text_hint'))
.caretColor($r('app.color.brand'))
.backgroundColor($r('app.color.input_bg'))
.borderRadius(10)
.border({ width: 1.5, color: $r('app.color.brand') })
@@ -364,6 +365,8 @@ struct CalendarListPage {
.height('100%')
.padding({ left: 24, right: 24, top: 16, bottom: 24 })
.backgroundColor($r('app.color.page_bg'))
// 沉浸式:背景延伸到状态栏/导航条区域(只扩绘制、不移动子组件)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.alignItems(HorizontalAlign.Center)
}
}
@@ -318,6 +318,7 @@ struct EditAccountPage {
.fontSize(16)
.fontColor($r('app.color.text_primary'))
.placeholderColor($r('app.color.text_hint'))
.caretColor($r('app.color.brand'))
.backgroundColor($r('app.color.input_bg'))
.borderRadius(10)
.border({ width: 1.5, color: $r('app.color.brand') })
@@ -434,6 +435,8 @@ struct EditAccountPage {
.height('100%')
.padding({ left: 24, right: 24, top: 16, bottom: 24 })
.backgroundColor($r('app.color.page_bg'))
// 沉浸式:背景延伸到状态栏/导航条区域(只扩绘制、不移动子组件)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.alignItems(HorizontalAlign.Center)
}
}
@@ -425,6 +425,11 @@ struct EventEditPage {
.fontSize(16)
.backgroundColor($r('app.color.card_bg'))
.borderRadius(12)
// 显式指定文字/提示/光标颜色:TextInput 默认取系统主题色,
// 深色模式下会变成浅色文字 → 与卡片底色撞色而"看不清"
.fontColor($r('app.color.text_primary'))
.placeholderColor($r('app.color.text_hint'))
.caretColor($r('app.color.brand'))
.onChange((v: string) => {
this.title = v;
})
@@ -541,6 +546,9 @@ struct EventEditPage {
.fontSize(14)
.backgroundColor($r('app.color.card_bg'))
.borderRadius(12)
.fontColor($r('app.color.text_primary'))
.placeholderColor($r('app.color.text_hint'))
.caretColor($r('app.color.brand'))
.onChange((v: string) => {
this.location = v;
})
@@ -551,6 +559,9 @@ struct EventEditPage {
.fontSize(14)
.backgroundColor($r('app.color.card_bg'))
.borderRadius(12)
.fontColor($r('app.color.text_primary'))
.placeholderColor($r('app.color.text_hint'))
.caretColor($r('app.color.brand'))
.onChange((v: string) => {
this.description = v;
})
@@ -591,6 +602,8 @@ struct EventEditPage {
.height('100%')
.padding({ top: 12 })
.backgroundColor($r('app.color.page_bg'))
// 沉浸式:背景延伸到状态栏/导航条区域(只扩绘制、不移动子组件)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.bindSheet($$this.pickerShow, this.dateTimePickerSheet(), {
height: 380,
showClose: false,
@@ -698,6 +711,13 @@ struct EventEditPage {
.onDateChange((value: Date) => {
this.pickDate = value;
})
// 滚轮文字显式指定颜色:默认取系统主题色,深色模式下与弹层底色撞色会"看不清"
.textStyle({ color: $r('app.color.text_secondary'), font: { size: 14 } })
.selectedTextStyle({
color: $r('app.color.text_primary'),
font: { size: 16, weight: FontWeight.Medium }
})
.disappearTextStyle({ color: $r('app.color.text_hint'), font: { size: 14 } })
.layoutWeight(1)
.height(210)
if (!this.allDay) {
@@ -708,6 +728,12 @@ struct EventEditPage {
this.pickHour = value.hour;
this.pickMin = value.minute;
})
.textStyle({ color: $r('app.color.text_secondary'), font: { size: 14 } })
.selectedTextStyle({
color: $r('app.color.text_primary'),
font: { size: 16, weight: FontWeight.Medium }
})
.disappearTextStyle({ color: $r('app.color.text_hint'), font: { size: 14 } })
.layoutWeight(1)
.height(210)
}
+8 -4
View File
@@ -1042,6 +1042,10 @@ struct Index {
}
.width('100%')
.height('100%')
// 沉浸式:根容器背景延伸到状态栏/导航条区域(只扩绘制、不移动子组件),
// 配合 EntryAbility 里"系统栏透明"的设置,彻底消除顶部通知栏与底部灰条。
.backgroundColor($r('app.color.page_bg'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.bindSheet($$this.detailShow, this.detailSheet(), {
height: 540,
dragBar: true,
@@ -1299,7 +1303,7 @@ struct Index {
.borderRadius(12)
.backgroundColor($r('app.color.card_bg'))
.border({ width: 1, color: $r('app.color.shadow_color') })
.shadow({ radius: 12, color: '#22000000', offsetY: 4 })
.shadow({ radius: 12, color: $r('app.color.shadow_color'), offsetY: 4 })
.margin({ top: 56, right: 20 })
}
.width('100%')
@@ -2925,7 +2929,7 @@ struct DayTimelineView {
.height(this.hourUnit)
.textAlign(TextAlign.End)
.padding({ right: 4, top: 2 })
.border({ width: { bottom: 0.5 }, color: { bottom: '#14000000' } })
.border({ width: { bottom: 0.5 }, color: { bottom: $r('app.color.grid_line') } })
}, (h: number) => `h${h}`)
}
.width(36)
@@ -2941,7 +2945,7 @@ struct DayTimelineView {
.layoutWeight(1)
.height(this.viewH())
.alignContent(Alignment.TopStart)
.border({ width: { left: 0.5 }, color: { left: '#14000000' } })
.border({ width: { left: 0.5 }, color: { left: $r('app.color.grid_line') } })
}
.width('100%')
.alignItems(VerticalAlign.Top)
@@ -2959,7 +2963,7 @@ struct DayTimelineView {
Column()
.width('100%')
.height(this.hourUnit)
.border({ width: { bottom: 0.5 }, color: { bottom: '#14000000' } })
.border({ width: { bottom: 0.5 }, color: { bottom: $r('app.color.grid_line') } })
.hitTestBehavior(HitTestMode.None) // 装饰层子节点同样不参与命中测试
}, (h: number) => `gd_${h}`)
}
@@ -1083,5 +1083,7 @@ struct SettingsPage {
.width('100%')
.height('100%')
.backgroundColor($r('app.color.page_bg'))
// 沉浸式:背景延伸到状态栏/导航条区域(只扩绘制、不移动子组件)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
}