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 limitations 13 * under the License. 14 */ 15import ComponentConfig from './ComponentConfig'; 16import Router from '@system.router'; 17 18/** 19 * long head custom component 20 */ 21@Component 22export default struct LongHeadComponent { 23 private isActive: boolean= true; 24 private icBackIsVisibility: boolean= true; 25 private longHeadName: string | Resource = ''; 26 27 build() { 28 Row() { 29 Stack({ alignContent: Alignment.Center }) { 30 Image($r('app.media.ic_back')) 31 .height($r('app.float.wh_value_24')) 32 .width($r('app.float.wh_value_24')) 33 .fillColor($r('sys.color.ohos_id_color_primary')) 34 } 35 .margin({ right: $r('app.float.wh_value_12') }) 36 .backgroundColor($r('app.color.color_00000000_transparent')) 37 .visibility(this.icBackIsVisibility ? Visibility.Visible : Visibility.None) 38 .onClick(() => { 39 Router.back(); 40 }) 41 42 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 43 Text(this.longHeadName) 44 .fontSize($r('app.float.head_font_24')) 45 .fontColor($r('app.color.font_color_182431')) 46 .lineHeight($r('app.float.wh_value_0')) 47 .fontWeight(FontWeight.Bold) 48 .maxLines(ComponentConfig.MAX_LINES_3) 49 .textOverflow({ overflow: TextOverflow.Ellipsis }) 50 .width('90%') 51 .textAlign(TextAlign.Start); 52 } 53 .width(ComponentConfig.WH_100_100) 54 .height($r('app.float.wh_value_56')) 55 .width('90%') 56 } 57 .width(ComponentConfig.WH_100_100) 58 .padding({ left: $r('app.float.wh_value_30') }) 59 .height($r('app.float.wh_value_56')) 60 .alignItems(VerticalAlign.Center) 61 .align(Alignment.Center) 62 } 63}