updateTrim method

void updateTrim(
  1. double min,
  2. double max
)

Update minTrim and maxTrim.

The min param is the minimum position of the trimmed area on the slider The max param is the maximum position of the trimmed area on the slider

Arguments range are 0.0 to 1.0.

Implementation

void updateTrim(double min, double max) {
  assert(min < max,
      'Minimum trim value ($min) cannot be bigger and maximum trim value ($max)');

  // check that the new params does not cause a wrong duration
  final newDuration = Duration(
      milliseconds: (videoDuration.inMilliseconds * (max - min)).toInt());
  assert(newDuration <= maxDuration && newDuration >= minDuration,
      'Trim duration ($newDuration) cannot be bigger than $maxDuration or smaller than $minDuration');

  _minTrim = min;
  _maxTrim = max;
  _updateTrimRange();
}