From a6c4c38b2e1148ec7ed46d7ef37c9fac2cd4bcaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=9E=E6=BC=AA?= Date: Tue, 6 May 2025 17:32:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E5=B1=8F=E5=85=83=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=83=8C=E6=9D=BF=E6=A8=A1=E7=B3=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 连漪 --- customappbar/interfaces/custom_app_bar.js | 4 +++- customappbar/source/custom_app_bar.ets | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/customappbar/interfaces/custom_app_bar.js b/customappbar/interfaces/custom_app_bar.js index 38c1475..b509c68 100644 --- a/customappbar/interfaces/custom_app_bar.js +++ b/customappbar/interfaces/custom_app_bar.js @@ -55,6 +55,7 @@ const TITLE_MARGIN_RIGHT = 12; const TITLE_MARGIN_TOP = 8; const TITLE_LABEL_MARGIN = 8.5; const TITLE_TEXT_MARGIN = 3; +const TITLE_CONSTRAINT_SIZE = 'calc(100% - 73.5vp)'; const MD_WIDTH = 480; const LG_WIDTH_LIMIT = 0.6; const LG_WIDTH_HEIGHT_RATIO = 1.95; @@ -1016,6 +1017,7 @@ export class CustomAppBar extends ViewPU { Text.maxLines(1); Text.textOverflow({ overflow: TextOverflow.Ellipsis }); Text.ellipsisMode(EllipsisMode.END); + Text.constraintSize({ maxWidth: TITLE_CONSTRAINT_SIZE }); }, Text); Text.pop(); this.observeComponentCreation2((elmtId, isInitialRender) => { @@ -1186,7 +1188,7 @@ export class CustomAppBar extends ViewPU { }); Row.layoutWeight(1); Row.backgroundColor(Color.Transparent); - Row.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); + Row.backgroundBlurStyle(this.isHalfScreen ? BlurStyle.COMPONENT_ULTRA_THICK : undefined); Row.borderRadius({ topLeft: this.isHalfScreen ? HALF_CONTAINER_BORDER_SIZE : this.deviceBorderRadius, topRight: this.isHalfScreen ? HALF_CONTAINER_BORDER_SIZE : this.deviceBorderRadius, diff --git a/customappbar/source/custom_app_bar.ets b/customappbar/source/custom_app_bar.ets index f2686da..d094653 100644 --- a/customappbar/source/custom_app_bar.ets +++ b/customappbar/source/custom_app_bar.ets @@ -51,6 +51,7 @@ const TITLE_MARGIN_RIGHT: number = 12; const TITLE_MARGIN_TOP: number = 8; const TITLE_LABEL_MARGIN: number = 8.5; const TITLE_TEXT_MARGIN: number = 3; +const TITLE_CONSTRAINT_SIZE: string = 'calc(100% - 73.5vp)'; const MD_WIDTH: number = 480; const LG_WIDTH_LIMIT: number = 0.6; const LG_WIDTH_HEIGHT_RATIO: number = 1.95; @@ -563,6 +564,7 @@ export struct CustomAppBar { .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) .ellipsisMode(EllipsisMode.END) + .constraintSize({ maxWidth: TITLE_CONSTRAINT_SIZE }) SymbolGlyph($r('sys.symbol.chevron_right')) .height(CHEVRON_HEIGHT) .width(CHEVRON_WIDTH) @@ -686,7 +688,7 @@ export struct CustomAppBar { }) .layoutWeight(1) .backgroundColor(Color.Transparent) - .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK) + .backgroundBlurStyle(this.isHalfScreen ? BlurStyle.COMPONENT_ULTRA_THICK : undefined) .borderRadius({ topLeft: this.isHalfScreen ? HALF_CONTAINER_BORDER_SIZE : this.deviceBorderRadius, topRight: this.isHalfScreen ? HALF_CONTAINER_BORDER_SIZE : this.deviceBorderRadius, -- Gitee