CustomSelectUI.ets 467 Bytes

@Component
export struct CustomSelectUI {
  @State isOn: boolean = false
  selectCallback: (isOn: boolean) => void = () => {
  }
  build() {
    Button(){
      Image(this.isOn?$r("app.media.MyCollection_selected_icon"):$r("app.media.MyCollection_unselected_icon"))
    }
    .backgroundColor(Color.White)
    .type(ButtonType.Normal)
    .width(20)
    .height(20)
    .onClick(() => {
      this.isOn = !this.isOn;
      this.selectCallback(this.isOn)
    })
  }
}