Ink constructor Null safety

Ink(
  1. {Key? key,
  2. EdgeInsetsGeometry? padding,
  3. Color? color,
  4. Decoration? decoration,
  5. double? width,
  6. double? height,
  7. Widget? child}
)

Paints a decoration (which can be a simple color) on a Material.

The height and width values include the padding.

The color argument is a shorthand for decoration: BoxDecoration(color: color), which means you cannot supply both a color and a decoration argument. If you want to have both a color and a decoration, you can pass the color as the color argument to the BoxDecoration.

If there is no intention to render anything on this decoration, consider using a Container with a BoxDecoration instead.

Implementation

Ink({
  super.key,
  this.padding,
  Color? color,
  Decoration? decoration,
  this.width,
  this.height,
  this.child,
}) : assert(padding == null || padding.isNonNegative),
     assert(decoration == null || decoration.debugAssertIsValid()),
     assert(color == null || decoration == null,
       'Cannot provide both a color and a decoration\n'
       'The color argument is just a shorthand for "decoration: BoxDecoration(color: color)".',
     ),
     decoration = decoration ?? (color != null ? BoxDecoration(color: color) : null);