image_crop icon indicating copy to clipboard operation
image_crop copied to clipboard

add: rounded crop mask

Open yk-curu2 opened this issue 4 years ago • 1 comments

Corresponds to the rounded crop mask.

Crop.file(
  file,
  key: cropKey,
  aspectRatio: aspect,
  shape: Shape.circle,  // default is Shape.rectangle
)

yk-curu2 avatar Nov 26 '20 03:11 yk-curu2

There already is BoxShape in flutter/painting.dart

enum BoxShape {
  /// An axis-aligned, 2D rectangle. May have rounded corners (described by a
  /// [BorderRadius]). The edges of the rectangle will match the edges of the box
  /// into which the [Border] or [BoxDecoration] is painted.
  ///
  /// See also:
  ///
  ///  * [RoundedRectangleBorder], the equivalent [ShapeBorder].
  rectangle,

  /// A circle centered in the middle of the box into which the [Border] or
  /// [BoxDecoration] is painted. The diameter of the circle is the shortest
  /// dimension of the box, either the width or the height, such that the circle
  /// touches the edges of the box.
  ///
  /// See also:
  ///
  ///  * [CircleBorder], the equivalent [ShapeBorder].
  circle,

  // Don't add more, instead create a new ShapeBorder.
}

However I'd recommend to use BorderShape to allow setting a rounded rectangle as well.

darkstarx avatar Apr 15 '21 18:04 darkstarx