PlayerDetailContainer.ets
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* 详情view&播放器view的容器布局组件
*/
@Entry
@Component
export struct PlayerDetailContainer {
@BuilderParam playerView: () => void
@BuilderParam playControlView: () => void
@BuilderParam detailView: () => void
@Consume isFullScreen: boolean
build() {
RelativeContainer() {
Stack() {
Row() {
this.playerView()
}
.height('100%')
.width('100%')
.zIndex(0)
Row() {
this.playControlView()
}
.height('100%')
.width('100%')
.zIndex(1)
}
.width('100%')
// .aspectRatio(this.isFullScreen ? 0.1 : 16 / 9.0) // 若width值确定,当aspectRatio值越小,则height值越大
.height(this.isFullScreen ? '100%' : 200)
.margin({ top: this.isFullScreen ? 0 : 174 })
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
// middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.id('stk_player_container')
if (!this.isFullScreen) {
Row() {
this.detailView()
}
.width('100%')
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
// middle: { anchor: '__container__', align: HorizontalAlign.Center }
})
.id('row_bottomView')
}
}
.width('100%')
.height('100%')
}
}