DetailDialog.ets
2.18 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { DateTimeUtils } from 'wdKit'
@Preview
@CustomDialog
export struct DetailDialog {
controller: CustomDialogController
@Prop name: string
@Prop title: string
@Prop summary: string
@Prop publishTime: string
@Link isOpenDetail: boolean
build() {
Column() {
Scroll() {
Column() {
if (this.name) {
Text(`@${this.name}`)
.fontColor(Color.White)
.fontSize(14)
.fontWeight(600)
.lineHeight(17)
.margin({ top: 8 })
}
if (this.title) {
Text(this.title)
.fontColor(Color.White)
.fontSize(16)
.fontWeight(600)
.margin({ top: 8 })
.lineHeight(24)
}
Text(this.summary)
.fontColor(Color.White)
.fontSize(14)
.fontWeight(400)
.margin({ top: 8 })
.lineHeight(21)
Text(DateTimeUtils.formatDate(new Date(this.publishTime).getTime(),
DateTimeUtils.PATTERN_DATE_TIME_HYPHEN_MM))
.fontSize(12)
.fontColor(Color.White)
.opacity(0.7)
.lineHeight(16)
.fontWeight(400)
.fontFamily('PingFang SC-Regular')
.margin({ top: 8, bottom: 8 })
}
.alignItems(HorizontalAlign.Start)
}
.height(200)
Row() {
Image($r("app.media.icon_arrow_left_white"))
.rotate({ angle: -90, centerX: '50%', centerY: '50%' })
.height(24).margin({ top: 20 }).onClick(() => {
this.controller.close()
if (this.isOpenDetail) {
this.isOpenDetail = !this.isOpenDetail
}
})
}.width('100%').justifyContent(FlexAlign.Center)
}
.width('100%')
.alignItems(HorizontalAlign.Start)
// .backgroundColor('#80000000')
.linearGradient({
direction: GradientDirection.Bottom, // 渐变方向
colors: [['rgba(0,0,0,0)', 0.1], ['#000000', 0.66],
['#000000', 1.0]] // 数组末尾元素占比小于1时满足重复着色效果
})
.padding({
top: 20,
bottom: 30,
left: 16,
right: 16
})
}
}