NeedlePointer constructor

const NeedlePointer({
  1. Key? key,
  2. double value = 0,
  3. bool enableDragging = false,
  4. ValueChanged<double>? onValueChanged,
  5. ValueChanged<double>? onValueChangeStart,
  6. ValueChanged<double>? onValueChangeEnd,
  7. ValueChanged<ValueChangingArgs>? onValueChanging,
  8. KnobStyle? knobStyle,
  9. TailStyle? tailStyle,
  10. LinearGradient? gradient,
  11. double needleLength = 0.6,
  12. GaugeSizeUnit lengthUnit = GaugeSizeUnit.factor,
  13. double needleStartWidth = 1,
  14. double needleEndWidth = 10,
  15. NeedlePointerRendererFactory<NeedlePointerRenderer>? onCreatePointerRenderer,
  16. bool enableAnimation = false,
  17. double animationDuration = 1000,
  18. AnimationType animationType = AnimationType.ease,
  19. Color? needleColor,
})

Create a needle pointer with the default or required properties.

The arguments value, must not be null and animationDuration, needleLength, needleStartWidth, needleEndWidth must be non-negative.

Implementation

const NeedlePointer({
  Key? key,
  this.value = 0,
  this.enableDragging = false,
  this.onValueChanged,
  this.onValueChangeStart,
  this.onValueChangeEnd,
  this.onValueChanging,
  KnobStyle? knobStyle,
  this.tailStyle,
  this.gradient,
  this.needleLength = 0.6,
  this.lengthUnit = GaugeSizeUnit.factor,
  this.needleStartWidth = 1,
  this.needleEndWidth = 10,
  this.onCreatePointerRenderer,
  this.enableAnimation = false,
  this.animationDuration = 1000,
  this.animationType = AnimationType.ease,
  this.needleColor,
}) : knobStyle = knobStyle ?? const KnobStyle(),
     assert(
       animationDuration > 0,
       'Animation duration must be a non-negative value',
     ),
     assert(needleLength >= 0, 'Needle length must be greater than zero.'),
     assert(
       needleStartWidth >= 0,
       'Needle start width must be greater than zero.',
     ),
     assert(
       needleEndWidth >= 0,
       'Needle end width must be greater than zero.',
     ),
     super(key: key);