SlideAction constructor

SlideAction({
  1. Key? key,
  2. required Widget child,
  3. VoidCallback? onTap,
  4. Color? color,
  5. Decoration? decoration,
  6. bool closeOnTap = _kCloseOnTap,
})

Creates a slide action with a child.

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.

The closeOnTap argument must not be null.

Implementation

SlideAction({
  Key? key,
  required this.child,
  VoidCallback? onTap,
  Color? color,
  Decoration? decoration,
  bool closeOnTap = _kCloseOnTap,
})  : 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),
      super(
        key: key,
        onTap: onTap,
        closeOnTap: closeOnTap,
        color: color ?? Colors.transparent,
      );