addDialogController = new CustomDialogController({
builder: BaseDialogView({
value: value,
}),
alignment: DialogAlignment.Bottom,
autoCancel: false,
customStyle: true,
maskColor: Color.Red,
// maskRect: ({x:0,y:300 ,width:'100%',height:'100%'}),
maskRect: ({
x: 0,
y: AppUtils.deviceHeight() - addDialogHeight - 5,
width: '100%',
height: '100%'
}),
})
可以使用mediaquery.matchMediaSync事件监听屏幕旋转状态,用@state修饰变量,在监听到屏幕旋转后直接修改maskRect的值参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-common-components-custom-dialog-V5