From 3b5c3a1ceb0bf1b6e8a3164e3ce7f23be81589d7 Mon Sep 17 00:00:00 2001 From: he-qianbei Date: Wed, 13 Nov 2024 17:30:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=A7=E5=AD=97=E4=BD=93+?= =?UTF-8?q?=E5=8F=8C=E5=B1=8F+=E6=A8=AA=E5=B1=8F=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E5=8A=A0=E5=AF=86=E5=88=86=E4=BA=AB=E9=A1=B5?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E6=8C=89=E9=92=AE=E4=BD=8D=E7=BD=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: he-qianbei --- entry/src/main/ets/common/constant.ets | 4 ++-- entry/src/main/ets/pages/encryptedSharing.ets | 24 +++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/entry/src/main/ets/common/constant.ets b/entry/src/main/ets/common/constant.ets index 3d5ae6f..ca11074 100644 --- a/entry/src/main/ets/common/constant.ets +++ b/entry/src/main/ets/common/constant.ets @@ -228,10 +228,10 @@ export default class Constants { public static SHARE_TEXT_INPUT_MARGIN_LEFT = 16; public static SHARE_TEXT_INPUT_COLUMN_HEIGHT = 120; public static SHARE_BUTTON_WIDTH = '100%'; - public static SHARE_BUTTON_MARGIN_TOP = 16; public static SHARE_BUTTON_MARGIN_LEFT = 16; public static SHARE_BUTTON_MARGIN_RIGHT = 16; - public static SHARE_BUTTON_PADDING_BOTTOM = 24; + public static SHARE_BUTTON_PADDING_BOTTOM = 16; + public static SHARE_BUTTON_COLUMN_BOTTOM = 56; public static SHARE_PAGES_COLUMN_WIDTH = '100%'; public static SHARE_PAGES_COLUMN_HEIGHT = '100%'; public static SHARE_SET_TIMEOUT = 1500; diff --git a/entry/src/main/ets/pages/encryptedSharing.ets b/entry/src/main/ets/pages/encryptedSharing.ets index c559e6e..248b2a7 100644 --- a/entry/src/main/ets/pages/encryptedSharing.ets +++ b/entry/src/main/ets/pages/encryptedSharing.ets @@ -97,6 +97,7 @@ struct encryptedSharing { @State osVersion: ResourceStr = ''; @State isTextInputFocus: boolean = false; @State generalType: string = 'general.file'; + @State scrollHeight: number = 188; @Builder contactsPicker() { @@ -500,6 +501,15 @@ struct encryptedSharing { }, Constants.ENCRYPTION_SET_TIMEOUT_TIME); } + getScrollHeight(newValue: SizeOptions) { + const height = newValue.height as number; + this.scrollHeight = height - Constants.SHARE_BUTTON_COLUMN_BOTTOM - Constants.SHARE_TITLE_HEAD_HEIGHT + - Constants.SHARE_TITLE_HEAD_MARGIN_TOP - Constants.SHARE_TITLE_HEAD_MARGIN_BOTTOM; + if (this.scrollHeight > Constants.SHARE_TEXTAREA_MAX_HEIGHT) { + this.scrollHeight = Constants.SHARE_TEXTAREA_MAX_HEIGHT; + } + } + aboutToAppear() { HiLog.info(TAG, `aboutToAppear enter: ${this.showUIExtensionForAccountLogin}`); this.getLoginStatus(); @@ -627,7 +637,7 @@ struct encryptedSharing { } .align(Alignment.TopStart) .constraintSize({ - minHeight: `${Constants.SHARE_TEXTAREA_MAX_HEIGHT}vp` + minHeight: `${this.scrollHeight}vp` }) .padding({ top: Constants.SHARE_TITLE_HEAD_MARGIN_BOTTOM @@ -645,11 +655,13 @@ struct encryptedSharing { } .justifyContent(FlexAlign.Center) .margin({ - top: Constants.SHARE_BUTTON_MARGIN_TOP, left: Constants.SHARE_BUTTON_MARGIN_LEFT, right: Constants.SHARE_BUTTON_MARGIN_RIGHT, bottom: Constants.SHARE_BUTTON_PADDING_BOTTOM }) + .constraintSize({ + minHeight: `${Constants.SHARE_BUTTON_COLUMN_BOTTOM}vp` + }) } .width(Constants.SHARE_PAGES_COLUMN_WIDTH) .height(Constants.SHARE_PAGES_COLUMN_HEIGHT) @@ -701,5 +713,13 @@ struct encryptedSharing { }) } } + .onSizeChange((oldValue: SizeOptions, newValue: SizeOptions) => { + const newHeight = newValue.height as number; + const oldHeight = oldValue.height as number; + if (newHeight === oldHeight) { + return; + } + this.getScrollHeight(newValue); + }) } } \ No newline at end of file