Skip to content

Commit bbf5c6e

Browse files
authored
merge: pull request #608 from hm21:dev
fix(video-editor): resolve incorrect behavior of maxTrimDuration `
2 parents 01e95ee + 6867c17 commit bbf5c6e

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 11.0.1
4+
**FIX**(video-editor): Resolve incorrect behavior of `maxTrimDuration`.
5+
36
## 11.0.0
47
- **FEAT**(multi-select): Layers can now be selected simultaneously using Ctrl, Shift, or long-press gestures.
58
- **FEAT**(grouping): Layers can be grouped for unified selection and movement.

lib/core/models/editor_configs/video_editor_configs.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class VideoEditorConfigs {
2727
this.enableEstimatedFileSize = false,
2828
this.controlsPosition = VideoEditorControlPosition.top,
2929
this.minTrimDuration = const Duration(seconds: 7),
30-
this.maxTrimDuration = const Duration(days: 36500),
30+
this.maxTrimDuration,
3131
this.animatedIndicatorDuration = const Duration(milliseconds: 200),
3232
this.animatedIndicatorSwitchInCurve = Curves.ease,
3333
this.animatedIndicatorSwitchOutCurve = Curves.ease,
@@ -92,7 +92,7 @@ class VideoEditorConfigs {
9292
final Duration minTrimDuration;
9393

9494
/// Maximum trim duration allowed.
95-
final Duration maxTrimDuration;
95+
final Duration? maxTrimDuration;
9696

9797
/// Position of the control bar in the video editor.
9898
final VideoEditorControlPosition controlsPosition;

lib/shared/controllers/video_controller.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class ProVideoController {
8484
late final trimDurationSpanNotifier = ValueNotifier<TrimDurationSpan>(
8585
TrimDurationSpan(
8686
start: Duration.zero,
87-
end: videoDuration < configs.maxTrimDuration
87+
end: configs.maxTrimDuration == null
8888
? videoDuration
89-
: configs.maxTrimDuration,
89+
: configs.maxTrimDuration!,
9090
),
9191
);
9292

lib/shared/widgets/video/trimmer/video_editor_trim_bar.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class _VideoEditorTrimBarState extends State<VideoEditorTrimBar> {
3636
double get _minTrimPercentage =>
3737
_player.configs.minTrimDuration.inMicroseconds / _videoDuration;
3838
double get _maxTrimPercentage =>
39-
_player.configs.maxTrimDuration.inMicroseconds / _videoDuration;
39+
(_player.configs.maxTrimDuration?.inMicroseconds ?? _videoDuration) /
40+
_videoDuration;
4041

4142
bool _isUpdatingTrimBar = false;
4243

@@ -81,7 +82,7 @@ class _VideoEditorTrimBarState extends State<VideoEditorTrimBar> {
8182

8283
if (_trimEnd > 1) {
8384
_trimEnd = 1;
84-
_trimStart = max(0, 1 - _maxTrimPercentage);
85+
_trimStart = max(0, 1 - _minTrimPercentage);
8586
}
8687

8788
_updateTrimSpan();
@@ -95,7 +96,7 @@ class _VideoEditorTrimBarState extends State<VideoEditorTrimBar> {
9596

9697
if (_trimStart < 0) {
9798
_trimStart = 0;
98-
_trimEnd = min(1, _maxTrimPercentage);
99+
_trimEnd = min(1, _minTrimPercentage);
99100
}
100101

101102
_updateTrimSpan();

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: pro_image_editor
22
description: "A Flutter image editor: Seamlessly enhance your images with user-friendly editing features."
3-
version: 11.0.0
3+
version: 11.0.1
44
homepage: https://github.com/hm21/pro_image_editor/
55
repository: https://github.com/hm21/pro_image_editor/
66
documentation: https://github.com/hm21/pro_image_editor/

0 commit comments

Comments
 (0)