修复大字体+双屏+横屏状态下,加密分享页确认按钮位置问题

Signed-off-by: he-qianbei <heqianbei@huawei.com>
This commit is contained in:
he-qianbei 2024-11-13 17:30:01 +08:00
parent 8681c3c219
commit 3b5c3a1ceb
2 changed files with 24 additions and 4 deletions

View File

@ -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;

View File

@ -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);
})
}
}