From de76ced044cbbfdf47a80935726f93b6d42bd2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=9E=E6=BC=AA?= Date: Wed, 19 Mar 2025 17:00:14 +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=9C=86=E8=A7=92=E4=B8=8E=E5=B1=8F=E5=B9=95=E5=9C=86=E8=A7=92?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 连漪 --- customappbar/interfaces/custom_app_bar.js | 19 ++++++++++++++++--- customappbar/source/custom_app_bar.ets | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/customappbar/interfaces/custom_app_bar.js b/customappbar/interfaces/custom_app_bar.js index b9cd712..f6212ca 100644 --- a/customappbar/interfaces/custom_app_bar.js +++ b/customappbar/interfaces/custom_app_bar.js @@ -20,7 +20,7 @@ const curves = requireNativeModule('ohos.curves'); const display = requireNapi('display'); const mediaquery = requireNapi('mediaquery'); const LengthMetrics = requireNapi('arkui.node').LengthMetrics; - +const systemParameterEnhance = requireNapi('systemParameterEnhance'); const LOG_TAG = 'CustomAppBar'; const VIEW_WIDTH = 80; const VIEW_HEIGHT = 36; @@ -145,6 +145,7 @@ export class CustomAppBar extends ViewPU { this.fullContentMarginTop = 0; this.windowWidth = 0; this.windowHeight = 0; + this.deviceBorderRadius = '0'; this.smListener = mediaquery.matchMediaSync('(0vp { if (mediaQueryResult.matches) { @@ -1137,8 +1150,8 @@ export class CustomAppBar extends ViewPU { Row.backgroundColor(Color.Transparent); Row.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); Row.borderRadius({ - topLeft: HALF_CONTAINER_BORDER_SIZE, - topRight: HALF_CONTAINER_BORDER_SIZE, + topLeft: this.isHalfScreen ? HALF_CONTAINER_BORDER_SIZE : this.deviceBorderRadius, + topRight: this.isHalfScreen ? HALF_CONTAINER_BORDER_SIZE : this.deviceBorderRadius, }); Row.clip(true); Row.alignItems(VerticalAlign.Bottom); diff --git a/customappbar/source/custom_app_bar.ets b/customappbar/source/custom_app_bar.ets index 7723dc7..ff84270 100644 --- a/customappbar/source/custom_app_bar.ets +++ b/customappbar/source/custom_app_bar.ets @@ -15,6 +15,7 @@ import { curves, display, LengthMetrics, mediaquery } from '@kit.ArkUI'; import { image } from '@kit.ImageKit'; +import { systemParameterEnhance } from '@kit.BasicServicesKit'; const LOG_TAG: string = 'CustomAppBar'; const VIEW_WIDTH: number = 80; @@ -156,6 +157,7 @@ export struct CustomAppBar { private fullContentMarginTop: number = 0; private windowWidth: number = 0; private windowHeight: number = 0; + private deviceBorderRadius: string = '0'; private smListener: mediaquery.MediaQueryListener = mediaquery.matchMediaSync('(0vp { if (mediaQueryResult.matches) { @@ -665,8 +677,8 @@ export struct CustomAppBar { .backgroundColor(Color.Transparent) .backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK) .borderRadius({ - topLeft: HALF_CONTAINER_BORDER_SIZE, - topRight: HALF_CONTAINER_BORDER_SIZE, + topLeft: this.isHalfScreen ? HALF_CONTAINER_BORDER_SIZE : this.deviceBorderRadius, + topRight: this.isHalfScreen ? HALF_CONTAINER_BORDER_SIZE : this.deviceBorderRadius, }) .clip(true) .alignItems(VerticalAlign.Bottom) -- Gitee