onTap method

Widget onTap(
  1. dynamic action(), {
  2. LoadingStyle? loadingStyle,
})

On tap run a action.

Implementation

Widget onTap(Function() action, {LoadingStyle? loadingStyle}) {
  if (loadingStyle == null) {
    return InkWell(
      onTap: () async {
        await action();
      },
      splashColor: Colors.transparent,
      hoverColor: Colors.transparent,
      focusColor: Colors.transparent,
      child: this,
    );
  }

  return _TapLoadingWrapper(
    child: this,
    action: action,
    loadingStyle: loadingStyle,
  );
}