calculateSize method

  1. @override
Size calculateSize(
  1. int count
)
override

Calculates the size of canvas based on dots count, size and spacing

Implementers can override this function to calculate their own size

Implementation

@override
Size calculateSize(int count) {
  final activeDotWidth =
      activeDotDecoration.width + activeDotDecoration.dotBorder.neededSpace;
  final dotWidth = dotDecoration.width + dotDecoration.dotBorder.neededSpace;

  final maxWidth =
      dotWidth * (count - 1) + (spacing * count) + activeDotWidth;

  final offsetSpace =
      (dotDecoration.verticalOffset - activeDotDecoration.verticalOffset)
          .abs();
  final maxHeight = max(
    dotDecoration.height + offsetSpace + dotDecoration.dotBorder.neededSpace,
    activeDotDecoration.height +
        offsetSpace +
        activeDotDecoration.dotBorder.neededSpace,
  );
  return Size(maxWidth, maxHeight);
}