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
-
viewerWidth to define the total trimmer area width.
-
viewerHeight to define the total trimmer area height.
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 toBoxFit.fitHeight
. -
maxVideoLength for specifying the maximum length of the output video.
-
circlePaintColor
for specifying a color to the circle. By default it is set toColors.white
. -
borderPaintColor
for specifying a color to the border of the trim area. By default it is set toColors.white
. -
scrubberPaintColor
for specifying a color to the video scrubber inside the trim area. By default it is set toColors.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 toTextStyle(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);