int nearestBar(double now) { double index = now / ref.watch(chartDataProvider).itemWidth; int left = index.round(); return left; }