setCallback method

void setCallback(
  1. void callback()?
)

(en)Set this button callback.

(ja)このボタンのクリック時動作を設定します。

  • callback : Button callback.

Implementation

void setCallback(void Function()? callback) {
  if (elParams.p.type == EnumBtnType.icon ||
      elParams.p.type == EnumBtnType.iconFilled ||
      elParams.p.type == EnumBtnType.iconFilledTonal ||
      elParams.p.type == EnumBtnType.iconOutlined) {
    elParams.p.iconBtnParams!.onPressed = callback;
  } else if (elParams.p.type == EnumBtnType.block) {
    elParams.p.inkWellBtnParams!.onTap = callback;
  } else if (elParams.p.type == EnumBtnType.faSmall ||
      elParams.p.type == EnumBtnType.faExtended ||
      elParams.p.type == EnumBtnType.fa ||
      elParams.p.type == EnumBtnType.faLarge) {
    elParams.p.faButtonParams!.onPressed = callback;
  } else {
    elParams.p.normalBtnParams!.onPressed = callback;
  }
}