ChartItemComponent.ets
1.27 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
import { LiveRoomItemBean } from 'wdBean/Index'
import { LiveMessageRole } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'
// import { LengthMetrics } from '@kit.ArkUI'
@Component
export struct ChatItemComponent {
item: LiveRoomItemBean = {} as LiveRoomItemBean
aboutToAppear(): void {
}
build() {
Row() {
Text() {
if (this.item.role == LiveMessageRole.host) {
Span(' 主持人 ')
.fontSize(11)
.lineHeight(20)
.textBackgroundStyle({ color: "#70FFC63F", radius: 2 })
Span(' ')
}
if (this.item.role == LiveMessageRole.guest) {
Span(' 嘉宾 ')
.fontSize(11)
.lineHeight(20)
.textBackgroundStyle({ color: "#70FFC63F", radius: 2 })
Span(' ')
}
Span(this.item.senderUserName + ': ')
.fontColor('#FFFFC63F')
.padding({ right: 118 })
Span(this.item.text)
}
.fontSize(14)
.fontColor('#FFFFFFFF')
.lineHeight(22)
.textShadow({ offsetX: 1, offsetY: 1, color: '#4D000000', radius: 1 })
}
.backgroundColor('#4D000000')
.borderRadius(3)
.padding({
top: 6,
bottom: 6,
left: 8,
right: 8
})
.margin({ left: 16, bottom: 4 })
}
}