horizontalScrollPercent property

double get horizontalScrollPercent

Returns the horizontal scroll percentage (0.0 to 1.0).

Implementation

double get horizontalScrollPercent {
  if (softWrap) return 1.0;
  final contentWidth = _contentWidth;
  if (contentWidth <= 0 || _longestLineWidth <= contentWidth) return 1.0;
  if (xOffset >= _longestLineWidth - contentWidth) return 1.0;
  final x = xOffset.toDouble();
  final w = contentWidth.toDouble();
  final t = _longestLineWidth.toDouble();
  final v = x / (t - w);
  return v.clamp(0.0, 1.0);
}