Ink.image constructor

Ink.image(
  1. {Key key,
  2. EdgeInsetsGeometry padding,
  3. @required ImageProvider image,
  4. ImageErrorListener onImageError,
  5. ColorFilter colorFilter,
  6. BoxFit fit,
  7. AlignmentGeometry alignment: Alignment.center,
  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.

The image argument must not be null. 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.

Implementation

Ink.image({
  Key key,
  this.padding,
  @required ImageProvider image,
  ImageErrorListener onImageError,
  ColorFilter colorFilter,
  BoxFit fit,
  AlignmentGeometry alignment = Alignment.center,
  Rect centerSlice,
  ImageRepeat repeat = ImageRepeat.noRepeat,
  bool matchTextDirection = false,
  this.width,
  this.height,
  this.child,
}) : assert(padding == null || padding.isNonNegative),
     assert(image != null),
     assert(alignment != null),
     assert(repeat != null),
     assert(matchTextDirection != null),
     decoration = BoxDecoration(
       image: DecorationImage(
         image: image,
         onError: onImageError,
         colorFilter: colorFilter,
         fit: fit,
         alignment: alignment,
         centerSlice: centerSlice,
         repeat: repeat,
         matchTextDirection: matchTextDirection,
       ),
     ),
     super(key: key);