Ink.image constructor

  1. {Key? key,
  2. EdgeInsetsGeometry? padding,
  3. required ImageProvider<Object> image,
  4. ImageErrorListener? onImageError,
  5. ColorFilter? colorFilter,
  6. BoxFit? fit,
  7. AlignmentGeometry alignment =,
  8. Rect? centerSlice,
  9. ImageRepeat repeat = ImageRepeat.noRepeat,
  10. bool matchTextDirection = false,
  11. double? width,
  12. double? height,
  13. Widget? child}

Creates a widget that shows an image (obtained from an ImageProvider) on a Material.

This argument is a shorthand for passing a BoxDecoration that has only its BoxDecoration.image property set to the Ink constructor. The properties of the DecorationImage of that BoxDecoration are set according to the arguments passed to this method.

If there is no intention to render anything on this image, consider using a Container with a BoxDecoration.image instead. The onImageError argument may be provided to listen for errors when resolving the image.

The alignment, repeat, and matchTextDirection arguments must not be null either, but they have default values.

See paintImage for a description of the meaning of these arguments.


  required ImageProvider image,
  ImageErrorListener? onImageError,
  ColorFilter? colorFilter,
  BoxFit? fit,
  AlignmentGeometry alignment =,
  Rect? centerSlice,
  ImageRepeat repeat = ImageRepeat.noRepeat,
  bool matchTextDirection = false,
}) : assert(padding == null || padding.isNonNegative),
     decoration = BoxDecoration(
       image: DecorationImage(
         image: image,
         onError: onImageError,
         colorFilter: colorFilter,
         fit: fit,
         alignment: alignment,
         centerSlice: centerSlice,
         repeat: repeat,
         matchTextDirection: matchTextDirection,