Ver Fonte

修改Modifier避让区

chenritian há 2 meses atrás
pai
commit
bf4701d272
1 ficheiros alterados com 5 adições e 4 exclusões
  1. 5 4
      commons/basic/src/main/ets/styles/AttributeModifier.ets

+ 5 - 4
commons/basic/src/main/ets/styles/AttributeModifier.ets

@@ -1,4 +1,5 @@
 import StyleConstants from '../constants/StyleConstants'
+import { YTAvoid } from '../utils/YTAvoid'
 
 export class BackgroundPageModifier implements AttributeModifier<CommonAttribute> {
   isNeedImage: boolean
@@ -21,8 +22,8 @@ export class BackgroundPageModifier implements AttributeModifier<CommonAttribute
         .backgroundImageSize({ width: '100%', height: '100%' })//backgroundImageSize((ImageSize.Cover))
         .backgroundImagePosition(Alignment.Center)
         .padding({
-          top: this.isNeedPaddingTop ? StyleConstants.TOP_HEIGHT : 0,
-          bottom: this.isNeedPaddingBottom ? StyleConstants.BOTTOM_HEIGHT : 0,
+          top: this.isNeedPaddingTop ? YTAvoid.getTop() : 0,
+          bottom: this.isNeedPaddingBottom ? YTAvoid.getBottom(): 0,
           left: 10,
           right: 10
         })
@@ -32,8 +33,8 @@ export class BackgroundPageModifier implements AttributeModifier<CommonAttribute
         .width(StyleConstants.FULL_PARENT)
         .backgroundColor($r("app.color.theme_bg_color"))
         .padding({
-          top: this.isNeedPaddingTop ? StyleConstants.TOP_HEIGHT : 0,
-          bottom: this.isNeedPaddingBottom ? StyleConstants.BOTTOM_HEIGHT : 0,
+          top: this.isNeedPaddingTop ? YTAvoid.getTop() : 0,
+          bottom: this.isNeedPaddingBottom ? YTAvoid.getBottom(): 0,
           left: 10,
           right: 10
         })