Ink.image constructor
- Key? key,
- EdgeInsetsGeometry? padding,
- required ImageProvider<
Object> image, - ImageErrorListener? onImageError,
- ColorFilter? colorFilter,
- BoxFit? fit,
- AlignmentGeometry alignment = Alignment.center,
- Rect? centerSlice,
- ImageRepeat repeat = ImageRepeat.noRepeat,
- bool matchTextDirection = false,
- double? width,
- double? height,
- 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.
Implementation
Ink.image({
super.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),
decoration = BoxDecoration(
image: DecorationImage(
image: image,
onError: onImageError,
colorFilter: colorFilter,
fit: fit,
alignment: alignment,
centerSlice: centerSlice,
repeat: repeat,
matchTextDirection: matchTextDirection,
),
);