tapImage static method

Widget tapImage(
  1. String? imageName,
  2. VoidCallback onTap, {
  3. double? width,
  4. double? height,
  5. double? size,
  6. BoxFit fit = BoxFit.contain,
  7. bool excludeFromSemantics = false,
  8. double? paddingH = 0,
  9. double? paddingV = 0,
  10. bool gaplessPlayback = false,
  11. Color? imageColor,
  12. bool primary = false,
  13. BuildContext? context,
  14. bool disabled = false,
})

Implementation

static Widget tapImage(String? imageName, VoidCallback onTap,
    {double? width, double? height, double? size, BoxFit fit = BoxFit.contain,
    bool excludeFromSemantics = false, double? paddingH = 0, double? paddingV = 0,
    bool gaplessPlayback = false, Color? imageColor, bool primary = false, BuildContext? context,
      bool disabled = false,}) {
  var maxValue = max(max(width ?? 0, height ?? 0), size ?? 0);
  if (imageName == null || imageName.isEmpty) {
    return SizedBox(width: maxValue, height: maxValue,);
  }
  var imageWidget = Container(
    padding: EdgeInsets.symmetric(
        horizontal: paddingH ?? 0, vertical: paddingV ?? 0),
    child: image(imageName, width: width ?? maxValue, height: height ?? maxValue,
      fit: fit, excludeFromSemantics: excludeFromSemantics, gaplessPlayback: gaplessPlayback,),
  );
  return GestureDetector(behavior: HitTestBehavior.translucent,
    onTap: disabled ? null : onTap, child: Opacity(opacity: disabled?0.5:1,
    child: imageColor != null || (primary && context != null)
        ? ColorFiltered(colorFilter: ColorFilter.mode(
        primary ? Theme.of(context!).colorScheme.primary : imageColor!, BlendMode.srcIn),
      child: imageWidget,) : imageWidget,),
  );
}