scroll method

dynamic scroll(
  1. bool repeated
)

Implementation

scroll(bool repeated) async {
  do {
    if (_scrollController.hasClients) {
      await Future.delayed(pauseDuration);
      if (_scrollController.hasClients)
        await _scrollController.animateTo(
            _scrollController.position.maxScrollExtent,
            duration: animationDuration,
            curve: forwardAnimation);
      await Future.delayed(pauseDuration);
      if (_scrollController.hasClients)
        switch (directionMarguee) {
          case DirectionMarguee.oneDirection:
            _scrollController.jumpTo(
              0.0,
            );
            break;
          case DirectionMarguee.TwoDirection:
            await _scrollController.animateTo(0.0,
                duration: backDuration, curve: backwardAnimation);
            break;
        }
      repeated = autoRepeat;
    } else {
      await Future.delayed(pauseDuration);
    }
  } while (repeated);
}