ArkUI写的备忘录任务

效果
是否完成是用了两张图片
在这里插入图片描述
代码

@Entry
@Component
struct BWLPage {
  @State title: string = '备忘录';
@State tasks:string[] = ['起床','敲代码','睡觉','玩游戏','谈恋爱','打瓦','逗猫','吃饭','看电视']
  build() {
    Column(){
      Column(){
        Text(this.title)
          .fontSize(80)
      }
      .width('100%')
      .height(100)
      List({space:8}){
        ForEach(this.tasks,(item:string,index)=>{
          ListItem() {
            ItemCom({ taskName: item })
          }
        })
      }
      .height('80%')
      .alignListItem(ListItemAlign.Center)
      .scrollBar(BarState.Auto)
      Row(){
        Text('海草笔记')
          .fontSize(20)
      }
      .height(20)
      .padding(9)
    }
  }
}

@Component
struct ItemCom{
  @State taskName:string=''
  @State finished:boolean = false
  build() {
    Row(){
      //选项部分
      Image(this.finished?$r('app.media.bwl_finish_true'):$r('app.media.bwl_finish_false'))
        .width(80)
        .height(80)
      //文字部分
      Text(this.taskName)
        .fontSize(60)
        .fontColor(this.finished? Color.Gray: Color.Black)
        .decoration({
          type:this.finished?TextDecorationType.LineThrough:TextDecorationType.None
        })
    }
    .width('90%')
    .borderRadius('50%')
    .height(80)
    .backgroundColor('#ccc')
    .onClick(() => {
      this.finished = !this.finished
    })
  }
}
  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值