TrimViewer constructor
- Key? key,
- required Trimmer trimmer,
- Duration maxVideoLength = const Duration(milliseconds: 0),
- ViewerType type = ViewerType.auto,
- double viewerWidth = 50 * 8,
- double viewerHeight = 50,
- bool showDuration = true,
- TextStyle durationTextStyle = const TextStyle(color: Colors.white),
- DurationStyle durationStyle = DurationStyle.FORMAT_HH_MM_SS,
- dynamic onChangeStart(
- double startValue
- dynamic onChangeEnd(
- double endValue
- dynamic onChangePlaybackState(
- bool isPlaying
- double paddingFraction = 0.2,
- TrimEditorProperties editorProperties = const TrimEditorProperties(),
- TrimAreaProperties areaProperties = const TrimAreaProperties(),
- 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
-
viewerWidthto define the total trimmer area width. -
viewerHeightto define the total trimmer area height.
The optional parameters are:
-
typefor specifying the type of the trim viewer. -
fitfor specifying the image fit type of each thumbnail image. By default it is set toBoxFit.fitHeight. -
maxVideoLengthfor specifying the maximum length of the output video. -
circlePaintColorfor specifying a color to the circle. By default it is set toColors.white. -
borderPaintColorfor specifying a color to the border of the trim area. By default it is set toColors.white. -
scrubberPaintColorfor specifying a color to the video scrubber inside the trim area. By default it is set toColors.white. -
thumbnailQualityfor specifying the quality of each generated image thumbnail, to be displayed in the trimmer area. -
showDurationfor showing the start and the end point of the video on top of the trimmer area. By default it is set totrue. -
durationTextStyleis for providing aTextStyleto the duration text. By default it is set toTextStyle(color: Colors.white) -
onChangeStartis a callback to the video start position. -
onChangeEndis a callback to the video end position. -
onChangePlaybackStateis a callback to the video playback state to know whether it is currently playing or paused. -
editorPropertiesdefines properties for customizing the trim editor. -
areaPropertiesdefines properties for customizing the trim area. -
onThumbnailLoadingCompleteis 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);