• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 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@Component
17export default struct PermissionListComponent {
18  private permissionName: string | Resource = '';
19  private permissionDescription: string | Resource = '';
20
21  build() {
22    Row() {
23      Image($r('app.media.rect1'))
24        .width($r('app.float.wh_value_7'))
25        .height($r('app.float.wh_value_7'))
26        .margin({
27          left: $r('app.float.wh_value_36'),
28          right: $r('app.float.wh_value_8') })
29        .objectFit(ImageFit.Contain);
30
31      Column() {
32        Text(this.permissionName)
33          .height($r('app.float.wh_value_22'))
34          .fontColor($r('sys.color.ohos_id_color_text_primary'))
35          .fontSize($r('app.float.font_16'))
36          .fontWeight(FontWeight.Medium)
37          .textAlign(TextAlign.Start)
38          .maxLines(3)
39          .textOverflow({ overflow: TextOverflow.Ellipsis })
40          .visibility(('' === this.permissionName || 'undefined' === typeof (this.permissionName) ||
41          null === this.permissionName) ? Visibility.None : Visibility.Visible)
42          .margin({
43            bottom: $r('app.float.wh_value_2'),
44          });
45
46        Text(this.permissionDescription)
47          .height($r('app.float.wh_value_19'))
48          .fontColor($r('sys.color.ohos_id_color_text_secondary'))
49          .fontSize($r('app.float.font_14'))
50          .fontWeight(FontWeight.Regular)
51          .textAlign(TextAlign.Start)
52          .maxLines(3)
53          .textOverflow({ overflow: TextOverflow.Ellipsis })
54          .visibility(('' === this.permissionDescription || 'undefined' === typeof (this.permissionDescription) ||
55          null === this.permissionDescription) ? Visibility.None : Visibility.Visible)
56      }
57      .alignItems(HorizontalAlign.Start)
58    }
59    .height($r('app.float.wh_value_64'))
60    .width('100%')
61    .margin({
62      top: $r('app.float.wh_value_12')
63    })
64    .align(Alignment.Start)
65    .alignItems(VerticalAlign.Center)
66  }
67}