calculateLeftOffset function
Implementation
double calculateLeftOffset(int targetIndex, double totalWidth) {
var totalElementsCount = 3;
var indicatorWidth = 30;
var spaceWidth = (totalWidth - indicatorWidth * totalElementsCount) / (totalElementsCount * 2);
var usedBySpaces = (1 + (targetIndex * 2)) * spaceWidth;
var usedByIndicators = targetIndex * indicatorWidth;
return usedBySpaces + usedByIndicators;
}