withPadding method

PriceRange withPadding({
  1. double topPaddingPercent = 0.08,
  2. double bottomPaddingPercent = 0.08,
})

Returns a new PriceRange with proportional top and bottom padding.

Implementation

PriceRange withPadding({
  double topPaddingPercent = 0.08,
  double bottomPaddingPercent = 0.08,
}) {
  final s = span == 0 ? 1.0 : span;
  final topPad = s * topPaddingPercent;
  final bottomPad = s * bottomPaddingPercent;
  return PriceRange(min - bottomPad, max + topPad);
}