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@CustomDialog 17export struct Warn { 18 private errMsg?: Resource 19 private limit?: string 20 private dialogController?: CustomDialogController 21 22 @Builder infoText(msg: Resource, limit: string) { 23 Row() { 24 Text(msg) 25 .margin({ left: 5 }) 26 .fontSize(18) 27 Text(limit) 28 .fontSize(18) 29 } 30 .margin(5) 31 } 32 33 build() { 34 Column() { 35 Text($r('app.string.warning')) 36 .margin(10) 37 .fontSize(20) 38 39 Column() { 40 this.infoText(this.errMsg, this.limit) 41 } 42 .padding(5) 43 .width('100%') 44 .borderRadius(10) 45 .alignItems(HorizontalAlign.Start) 46 } 47 .padding(5) 48 .width('100%') 49 .borderRadius(10) 50 .alignItems(HorizontalAlign.Start) 51 .onClick(() => { 52 this.dialogController.close() 53 }) 54 } 55}