TrimViewer constructor

const TrimViewer({
  1. Key? key,
  2. required Trimmer trimmer,
  3. Duration maxVideoLength = const Duration(milliseconds: 0),
  4. ViewerType type = ViewerType.auto,
  5. double viewerWidth = 50 * 8,
  6. double viewerHeight = 50,
  7. bool showDuration = true,
  8. TextStyle durationTextStyle = const TextStyle(color: Colors.white),
  9. DurationStyle durationStyle = DurationStyle.FORMAT_HH_MM_SS,
  10. dynamic onChangeStart(
    1. double startValue
    )?,
  11. dynamic onChangeEnd(
    1. double endValue
    )?,
  12. dynamic onChangePlaybackState(
    1. bool isPlaying
    )?,
  13. double paddingFraction = 0.2,
  14. TrimEditorProperties editorProperties = const TrimEditorProperties(),
  15. TrimAreaProperties areaProperties = const TrimAreaProperties(),
  16. VoidCallback? onThumbnailLoadingComplete,
})

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. It automatically selected whether to use FixedTrimViewer or ScrollableTrimViewer.

If you want to use a specific kind of trim viewer, use the type property.

The required parameters are viewerWidth & viewerHeight

The optional parameters are:

  • type for specifying the type of the trim viewer.

  • 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.

  • 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.

  • editorProperties defines properties for customizing the trim editor.

  • areaProperties defines properties for customizing the trim area.

  • onThumbnailLoadingComplete is a callback for thumbnail loader to know when all the thumbnails are loaded.

Implementation

const TrimViewer({
  Key? key,
  required this.trimmer,
  this.maxVideoLength = const Duration(milliseconds: 0),
  this.type = ViewerType.auto,
  this.viewerWidth = 50 * 8,
  this.viewerHeight = 50,
  this.showDuration = true,
  this.durationTextStyle = const TextStyle(color: Colors.white),
  this.durationStyle = DurationStyle.FORMAT_HH_MM_SS,
  this.onChangeStart,
  this.onChangeEnd,
  this.onChangePlaybackState,
  this.paddingFraction = 0.2,
  this.editorProperties = const TrimEditorProperties(),
  this.areaProperties = const TrimAreaProperties(),
  this.onThumbnailLoadingComplete,
}) : super(key: key);