TrimEditor constructor

const TrimEditor({
  1. Key? key,
  2. required Trimmer trimmer,
  3. double viewerWidth = 50.0 * 8,
  4. double viewerHeight = 50,
  5. BoxFit fit = BoxFit.fitHeight,
  6. Duration maxVideoLength = const Duration(milliseconds: 0),
  7. double circleSize = 5.0,
  8. double borderWidth = 3,
  9. double scrubberWidth = 1,
  10. double circleSizeOnDrag = 8.0,
  11. Color circlePaintColor = Colors.white,
  12. Color borderPaintColor = Colors.white,
  13. Color scrubberPaintColor = Colors.white,
  14. int thumbnailQuality = 75,
  15. bool showDuration = true,
  16. int sideTapSize = 24,
  17. TextStyle durationTextStyle = const TextStyle(color: Colors.white),
  18. dynamic onChangeStart(
    1. double startValue
    )?,
  19. dynamic onChangeEnd(
    1. double endValue
    )?,
  20. dynamic onChangePlaybackState(
    1. bool isPlaying
    )?,
})

Widget for displaying the video trimmer.

This has frame wise preview of the video with a slider for selecting the part of the video to be trimmed.

The required parameters are viewerWidth & viewerHeight

The optional parameters are:

  • fit for specifying the image fit type of each thumbnail image. By default it is set to BoxFit.fitHeight.

  • maxVideoLength for specifying the maximum length of the output video.

  • circleSize for specifying a size to the holder at the two ends of the video trimmer area, while it is idle. By default it is set to 5.0.

  • circleSizeOnDrag for specifying a size to the holder at the two ends of the video trimmer area, while it is being dragged. By default it is set to 8.0.

  • circlePaintColor for specifying a color to the circle. By default it is set to Colors.white.

  • borderPaintColor for specifying a color to the border of the trim area. By default it is set to Colors.white.

  • scrubberPaintColor for specifying a color to the video scrubber inside the trim area. By default it is set to Colors.white.

  • thumbnailQuality for specifying the quality of each generated image thumbnail, to be displayed in the trimmer area.

  • showDuration for showing the start and the end point of the video on top of the trimmer area. By default it is set to true.

  • durationTextStyle is for providing a TextStyle to the duration text. By default it is set to TextStyle(color: Colors.white)

  • onChangeStart is a callback to the video start position.

  • onChangeEnd is a callback to the video end position.

  • onChangePlaybackState is a callback to the video playback state to know whether it is currently playing or paused.

Implementation

const TrimEditor({
  Key? key,
  required this.trimmer,
  this.viewerWidth = 50.0 * 8,
  this.viewerHeight = 50,
  this.fit = BoxFit.fitHeight,
  this.maxVideoLength = const Duration(milliseconds: 0),
  this.circleSize = 5.0,
  this.borderWidth = 3,
  this.scrubberWidth = 1,
  this.circleSizeOnDrag = 8.0,
  this.circlePaintColor = Colors.white,
  this.borderPaintColor = Colors.white,
  this.scrubberPaintColor = Colors.white,
  this.thumbnailQuality = 75,
  this.showDuration = true,
  this.sideTapSize = 24,
  this.durationTextStyle = const TextStyle(color: Colors.white),
  this.onChangeStart,
  this.onChangeEnd,
  this.onChangePlaybackState,
}) : super(key: key);