18779efd5Sopenharmony_ci/**
28779efd5Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
38779efd5Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48779efd5Sopenharmony_ci * you may not use this file except in compliance with the License.
58779efd5Sopenharmony_ci * You may obtain a copy of the License at
68779efd5Sopenharmony_ci *
78779efd5Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88779efd5Sopenharmony_ci *
98779efd5Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108779efd5Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118779efd5Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128779efd5Sopenharmony_ci * See the License for the specific language governing permissions and
138779efd5Sopenharmony_ci * limitations under the License.
148779efd5Sopenharmony_ci */
158779efd5Sopenharmony_ci
168779efd5Sopenharmony_ci/**
178779efd5Sopenharmony_ci * The Delete dialog box is displayed at the bottom.
188779efd5Sopenharmony_ci */
198779efd5Sopenharmony_ci@CustomDialog
208779efd5Sopenharmony_ciexport default struct DeleteDialogEx {
218779efd5Sopenharmony_ci  controller: CustomDialogController;
228779efd5Sopenharmony_ci  cancel: () => void;
238779efd5Sopenharmony_ci  confirm: () => void;
248779efd5Sopenharmony_ci  title: string | Resource;
258779efd5Sopenharmony_ci  cancalText: string | Resource;
268779efd5Sopenharmony_ci  confrimText: string | Resource;
278779efd5Sopenharmony_ci
288779efd5Sopenharmony_ci  build() {
298779efd5Sopenharmony_ci    Flex({
308779efd5Sopenharmony_ci      direction: FlexDirection.Column,
318779efd5Sopenharmony_ci      justifyContent: FlexAlign.Center,
328779efd5Sopenharmony_ci      alignItems: ItemAlign.Center
338779efd5Sopenharmony_ci    }) {
348779efd5Sopenharmony_ci      Flex({
358779efd5Sopenharmony_ci        direction: FlexDirection.Column,
368779efd5Sopenharmony_ci        justifyContent: FlexAlign.Center,
378779efd5Sopenharmony_ci        alignItems: ItemAlign.Center
388779efd5Sopenharmony_ci      }) {
398779efd5Sopenharmony_ci        Text(this.title)
408779efd5Sopenharmony_ci          .fontSize(24)
418779efd5Sopenharmony_ci          .textOverflow({ overflow: TextOverflow.Ellipsis })
428779efd5Sopenharmony_ci          .maxLines(2)
438779efd5Sopenharmony_ci      }
448779efd5Sopenharmony_ci      .margin({ bottom: 10 })
458779efd5Sopenharmony_ci
468779efd5Sopenharmony_ci      Row() {
478779efd5Sopenharmony_ci        Flex({
488779efd5Sopenharmony_ci          direction: FlexDirection.Column,
498779efd5Sopenharmony_ci          justifyContent: FlexAlign.Center,
508779efd5Sopenharmony_ci          alignItems: ItemAlign.Center
518779efd5Sopenharmony_ci        }) {
528779efd5Sopenharmony_ci          Text(this.cancalText).fontColor($r('sys.color.ohos_id_color_text_primary_activated')).fontSize(20)
538779efd5Sopenharmony_ci        }
548779efd5Sopenharmony_ci        .layoutWeight(1)
558779efd5Sopenharmony_ci        .height(35)
568779efd5Sopenharmony_ci        .onClick(() => {
578779efd5Sopenharmony_ci          this.controller.close();
588779efd5Sopenharmony_ci          this.cancel();
598779efd5Sopenharmony_ci        })
608779efd5Sopenharmony_ci
618779efd5Sopenharmony_ci        Line().width(1).height(25).backgroundColor($r('sys.color.ohos_id_color_list_separator'))
628779efd5Sopenharmony_ci
638779efd5Sopenharmony_ci        Flex({
648779efd5Sopenharmony_ci          direction: FlexDirection.Column,
658779efd5Sopenharmony_ci          justifyContent: FlexAlign.Center,
668779efd5Sopenharmony_ci          alignItems: ItemAlign.Center
678779efd5Sopenharmony_ci        }) {
688779efd5Sopenharmony_ci          Text(this.confrimText).fontColor(Color.Red).fontSize(20)
698779efd5Sopenharmony_ci        }
708779efd5Sopenharmony_ci        .layoutWeight(1)
718779efd5Sopenharmony_ci        .height(35)
728779efd5Sopenharmony_ci        .onClick(() => {
738779efd5Sopenharmony_ci          this.controller.close();
748779efd5Sopenharmony_ci          this.confirm();
758779efd5Sopenharmony_ci        })
768779efd5Sopenharmony_ci      }
778779efd5Sopenharmony_ci      .height('30vp')
788779efd5Sopenharmony_ci    }
798779efd5Sopenharmony_ci    .width('90%')
808779efd5Sopenharmony_ci    .height($r('app.float.DeleteDialogEx_height'))
818779efd5Sopenharmony_ci    .borderRadius(20)
828779efd5Sopenharmony_ci    .padding({
838779efd5Sopenharmony_ci      bottom: $r('sys.float.ohos_id_dialog_margin_bottom'),
848779efd5Sopenharmony_ci      right: $r('sys.float.ohos_id_notification_margin_start'),
858779efd5Sopenharmony_ci      left: $r('sys.float.ohos_id_notification_margin_end')
868779efd5Sopenharmony_ci    })
878779efd5Sopenharmony_ci  }
888779efd5Sopenharmony_ci}