Open com8599 opened 4 months ago
I found out a solution
void _onDragUpdate(DragUpdateDetails details) {
if (!_allowDrag) return;
if (_dragType == EditorDragType.left) {
_startCircleSize = widget.editorProperties.circleSizeOnDrag;
if ((_startPos.dx + details.delta.dx >= 0) &&
(_startPos.dx + details.delta.dx <= _endPos.dx) &&
!(_endPos.dx - _startPos.dx - details.delta.dx > maxLengthPixels!)) {
_startPos += details.delta;
_onStartDragged();
}
} else if (_dragType == EditorDragType.center) {
_startCircleSize = widget.editorProperties.circleSizeOnDrag;
_endCircleSize = widget.editorProperties.circleSizeOnDrag;
if ((_startPos.dx + details.delta.dx >= 0) &&
(_endPos.dx + details.delta.dx <= _thumbnailViewerW)) {
_startPos += details.delta;
_endPos += details.delta;
_onStartDragged();
_onEndDragged();
}
} else {
_endCircleSize = widget.editorProperties.circleSizeOnDrag;
if ((_endPos.dx + details.delta.dx <= _thumbnailViewerW) &&
(_endPos.dx + details.delta.dx >= _startPos.dx) &&
!(_endPos.dx - _startPos.dx + details.delta.dx > maxLengthPixels!)) {
_endPos += details.delta;
_onStartDragged(); <- my code
_onEndDragged();
}
}
setState(() {});
}
...
/// Drag gesture ended, update UI accordingly.
void _onDragEnd(DragEndDetails details) {
setState(() {
_startCircleSize = widget.editorProperties.circleSize;
_endCircleSize = widget.editorProperties.circleSize;
if (_dragType == EditorDragType.right) {
videoPlayerController
.seekTo(Duration(milliseconds: _videoStartPos.toInt())); <- my code
// .seekTo(Duration(milliseconds: _videoEndPos.toInt())); <- pure code
} else {
videoPlayerController
.seekTo(Duration(milliseconds: _videoStartPos.toInt()));
}
});
}
please fix the line
env
I want to seek to
_startValue
and play when end dragging rightcircle, but when I drag rightcircle, it play at_endValue
and not looping. And I make this code. But, the code makes stackoverflow.stackoverflow message
I think that there are infinite loop in TrimViewer, Can you fix this problem?