ref |> 精选评论页适配全屏
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
1 changed file
with
34 additions
and
24 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -112,13 +112,12 @@ export struct QualityCommentsComponent { | @@ -112,13 +112,12 @@ export struct QualityCommentsComponent { | ||
| 112 | Image($r('app.media.comment_img_banner')).width('100%') | 112 | Image($r('app.media.comment_img_banner')).width('100%') |
| 113 | .height(283) | 113 | .height(283) |
| 114 | // .aspectRatio(375 / 283); | 114 | // .aspectRatio(375 / 283); |
| 115 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | ||
| 116 | } | 115 | } |
| 117 | .onAreaChange((oldValue: Area, newValue: Area) => { | 116 | .onAreaChange((oldValue: Area, newValue: Area) => { |
| 118 | - if (Number(oldValue.globalPosition.y) == 0 && Number(newValue.globalPosition.y) > 30) { | ||
| 119 | - this.firstPositionY = Number(newValue.globalPosition.y) | ||
| 120 | - return | ||
| 121 | - } | 117 | + // if (Number(oldValue.globalPosition.y) == 0 && Number(newValue.globalPosition.y) > 30) { |
| 118 | + // this.firstPositionY = Number(newValue.globalPosition.y) | ||
| 119 | + // return | ||
| 120 | + // } | ||
| 122 | Logger.debug(TAG, "oldValue.globalPosition.y : " + oldValue.globalPosition.y) | 121 | Logger.debug(TAG, "oldValue.globalPosition.y : " + oldValue.globalPosition.y) |
| 123 | Logger.debug(TAG, | 122 | Logger.debug(TAG, |
| 124 | "newValue.globalPosition.y : " + newValue.globalPosition.y + `,this.topSafeHeight : ` + this.topSafeHeight) | 123 | "newValue.globalPosition.y : " + newValue.globalPosition.y + `,this.topSafeHeight : ` + this.topSafeHeight) |
| @@ -128,9 +127,16 @@ export struct QualityCommentsComponent { | @@ -128,9 +127,16 @@ export struct QualityCommentsComponent { | ||
| 128 | persent = 1 | 127 | persent = 1 |
| 129 | } | 128 | } |
| 130 | this.tileOpacity = persent | 129 | this.tileOpacity = persent |
| 131 | - | 130 | + this.topOpacityChange() |
| 132 | }) | 131 | }) |
| 133 | } | 132 | } |
| 133 | + topOpacityChange(){ | ||
| 134 | + if(this.tileOpacity > 0.8){ | ||
| 135 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 136 | + }else{ | ||
| 137 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'}) | ||
| 138 | + } | ||
| 139 | + } | ||
| 134 | 140 | ||
| 135 | /*透明导航栏*/ | 141 | /*透明导航栏*/ |
| 136 | @Builder | 142 | @Builder |
| @@ -164,16 +170,20 @@ export struct QualityCommentsComponent { | @@ -164,16 +170,20 @@ export struct QualityCommentsComponent { | ||
| 164 | @Builder | 170 | @Builder |
| 165 | TabbarNormal() { | 171 | TabbarNormal() { |
| 166 | Stack({ alignContent: Alignment.Top }) { | 172 | Stack({ alignContent: Alignment.Top }) { |
| 173 | + //// 默认显示的白色返回按钮 | ||
| 167 | Row() { | 174 | Row() { |
| 168 | - } | ||
| 169 | - .width('100%') | ||
| 170 | - .height(px2vp(this.topSafeHeight)) | ||
| 171 | - .backgroundColor($r('app.color.white')) | ||
| 172 | - .opacity(this.tileOpacity) | ||
| 173 | - .visibility(this.tileOpacity > 0 ? 0 : 1) | ||
| 174 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) | 175 | + Image($r('app.media.icon_arrow_left_white')) |
| 176 | + .width(24).height(24) | ||
| 177 | + .objectFit(ImageFit.Auto) | ||
| 178 | + .margin({ left: 16, top: px2vp(this.topSafeHeight) + (44 - 24)/2}) | ||
| 179 | + .onClick(() => { | ||
| 180 | + router.back() | ||
| 181 | + }) | ||
| 182 | + }.width('100%').height(px2vp(this.topSafeHeight) + 44) | ||
| 183 | + .opacity(1- this.tileOpacity) | ||
| 175 | 184 | ||
| 176 | - Stack({ alignContent: Alignment.Start }) { | 185 | + //// 上滑显示的黑色按钮和标题 |
| 186 | + Stack({ alignContent: Alignment.Top }) { | ||
| 177 | Row() { | 187 | Row() { |
| 178 | Text('精选评论')// .height('42lpx') | 188 | Text('精选评论')// .height('42lpx') |
| 179 | .maxLines(1) | 189 | .maxLines(1) |
| @@ -182,25 +192,25 @@ export struct QualityCommentsComponent { | @@ -182,25 +192,25 @@ export struct QualityCommentsComponent { | ||
| 182 | .fontWeight(400) | 192 | .fontWeight(400) |
| 183 | .fontColor($r('app.color.color_222222')) | 193 | .fontColor($r('app.color.color_222222')) |
| 184 | .lineHeight('42lpx') | 194 | .lineHeight('42lpx') |
| 185 | - .visibility(this.tileOpacity < 0.8 ? 1 : 0) | ||
| 186 | } | 195 | } |
| 187 | - .height(44) | ||
| 188 | - .width('100%') | 196 | + .height(44).width('100%') |
| 189 | .justifyContent(FlexAlign.Center) | 197 | .justifyContent(FlexAlign.Center) |
| 190 | .alignItems(VerticalAlign.Center) | 198 | .alignItems(VerticalAlign.Center) |
| 191 | - .opacity(this.tileOpacity) | ||
| 192 | - .backgroundColor($r('app.color.white')) | ||
| 193 | 199 | ||
| 194 | - Image(this.tileOpacity < 0.8 ? $r('app.media.icon_arrow_left_white') : $r('app.media.icon_arrow_left')) | ||
| 195 | - .width(24) | ||
| 196 | - .height(24) | 200 | + Row() { |
| 201 | + Image($r('app.media.icon_arrow_left')) | ||
| 202 | + .width(24).height(24) | ||
| 197 | .objectFit(ImageFit.Auto) | 203 | .objectFit(ImageFit.Auto) |
| 198 | - .margin({ left: 16 }) | 204 | + .margin({ left: 16, top: (44-24)/2}) |
| 199 | .onClick(() => { | 205 | .onClick(() => { |
| 200 | router.back() | 206 | router.back() |
| 201 | }) | 207 | }) |
| 202 | - | 208 | + }.height(44).width('100%') |
| 203 | } | 209 | } |
| 210 | + .width('100%').height(px2vp(this.topSafeHeight) + 44) | ||
| 211 | + .backgroundColor($r('app.color.white')) | ||
| 212 | + .opacity(this.tileOpacity) | ||
| 213 | + .padding({top:px2vp(this.topSafeHeight)}) | ||
| 204 | } | 214 | } |
| 205 | 215 | ||
| 206 | } | 216 | } |
-
Please register or login to post a comment