• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16@Entry
17@Component
18struct Index {
19  @State fromAppName: string = 'Unknown'
20  @State toAppName: string = 'Unknown'
21  @State toastHeight: number = 0
22
23  async aboutToAppear() {
24    this.fromAppName = globalThis.toastInfo.fromAppName
25    this.toAppName = globalThis.toastInfo.toAppName
26    this.toastHeight = globalThis.toastInfo.displayHeight
27  }
28
29  build() {
30    Row() {
31      Column() {
32        Text() {
33          Span(this.toAppName).fontSize(14)
34            .fontWeight(FontWeight.Regular).fontColor($r('app.color.white')).fontFamily($r('app.string.typeface'))
35          Span($r('app.string.read')).fontSize(14)
36            .fontWeight(FontWeight.Regular).fontColor($r('app.color.white')).fontFamily($r('app.string.typeface'))
37          Span(this.fromAppName).fontSize(14)
38            .fontWeight(FontWeight.Regular).fontColor($r('app.color.white')).fontFamily($r('app.string.typeface'))
39          Span($r('app.string.info')).fontSize(14)
40            .fontWeight(FontWeight.Regular).fontColor($r('app.color.white')).fontFamily($r('app.string.typeface'))
41        }
42        .height(19)
43        .opacity(0.6)
44        .margin({ left: 16, right: 16, top:8, bottom:8 })
45      }
46      .height(36)
47      .backgroundColor($r('app.color.grey'))
48      .borderRadius(18)
49      .alignItems(HorizontalAlign.Center)
50      .justifyContent(FlexAlign.Center)
51    }
52    .alignItems(VerticalAlign.Bottom)
53    .justifyContent(FlexAlign.Center)
54    .height(this.toastHeight)
55    .width('100%')
56  }
57}