NumberLine constructor

NumberLine({
  1. Color color = LIGHT_GREY,
  2. double xMin = -FRAME_X_RADIUS,
  3. double xMax = FRAME_X_RADIUS,
  4. double unitSize = 1,
  5. bool includeTicks = true,
  6. double tickSize = 0.1,
  7. double tickFrequency = 1,
  8. double? leftmostTick,
  9. List<double> numbersWithElongatedTicks = const [0],
  10. bool includeNumbers = false,
  11. dynamic numbersToShow,
  12. double longTickMultiple = 2,
  13. double numberAtCenter = 0,
  14. double numberScaleVal = 0.75,
  15. Vector3 labelDirection = DOWN,
  16. double lineToNumberBuff = MED_SMALL_BUFFER,
  17. bool includeTip = true,
  18. double tipWidth = 0.25,
  19. double tipHeight = 0.25,
  20. dynamic decimalNumberConfig,
  21. bool excludeZeroFromDefaultNumbers = false,
})

Implementation

NumberLine({
  Color color = LIGHT_GREY,
  this.xMin = -FRAME_X_RADIUS,
  this.xMax = FRAME_X_RADIUS,
  this.unitSize = 1,
  this.includeTicks = true,
  this.tickSize = 0.1,
  this.tickFrequency = 1,
  this.leftmostTick,
  this.numbersWithElongatedTicks = const [0],
  this.includeNumbers = false,
  this.numbersToShow,
  this.longTickMultiple = 2,
  this.numberAtCenter = 0,
  this.numberScaleVal = 0.75,
  this.labelDirection = DOWN,
  this.lineToNumberBuff = MED_SMALL_BUFFER,
  this.includeTip = true,
  this.tipWidth = 0.25,
  this.tipHeight = 0.25,
  this.decimalNumberConfig,
  this.excludeZeroFromDefaultNumbers = false,
}) : super(color: color) {
  tipLength = max(tipWidth, tipHeight);

  if (includeTip) {
    xMax += tipLength / 2;
  }

  start = RIGHT * unitSize * xMin;
  end = RIGHT * unitSize * xMax;

  putStartAndEndOn(start, end);

  shift(numberToPoint(numberAtCenter) * -1);

  initLeftmostTick();

  if (includeTip) {
    addTip(tipLength: tipLength);
  }
  if (includeTicks) {
    addTickMarks();
  }
  if (includeNumbers) {
    // TODO addNumbers();
  }
}