RenderSignaturePad constructor

RenderSignaturePad({
  1. required double minimumStrokeWidth,
  2. required double maximumStrokeWidth,
  3. required Color backgroundColor,
  4. required Color strokeColor,
  5. required DeviceGestureSettings gestureSettings,
  6. SignatureOnDrawStartCallback? onDrawStart,
  7. SignatureDrawCallback? onDraw,
  8. VoidCallback? onDrawEnd,
})

Creates a new instance of RenderSignaturePad.

Implementation

RenderSignaturePad(
    {required double minimumStrokeWidth,
    required double maximumStrokeWidth,
    required Color backgroundColor,
    required Color strokeColor,
    required DeviceGestureSettings gestureSettings,
    SignatureOnDrawStartCallback? onDrawStart,
    SignatureDrawCallback? onDraw,
    VoidCallback? onDrawEnd})
    : _minimumStrokeWidth = minimumStrokeWidth,
      _maximumStrokeWidth = maximumStrokeWidth,
      _backgroundColor = backgroundColor,
      _strokeColor = strokeColor,
      _onDrawStart = onDrawStart,
      _onDraw = onDraw,
      _gestureArenaTeam = GestureArenaTeam(),
      _onDrawEnd = onDrawEnd {
  _panGestureRecognizer = PanGestureRecognizer()
    ..team = _gestureArenaTeam
    ..onStart = _handleDragStart
    ..onUpdate = _handleDragUpdate
    ..onEnd = _handleDragEnd
    ..gestureSettings = gestureSettings
    ..dragStartBehavior = DragStartBehavior.down;

  _verticalDragGestureRecognizer = VerticalDragGestureRecognizer()
    ..team = _gestureArenaTeam
    ..gestureSettings = gestureSettings
    ..onStart = _dragStart;

  _horizontalDragGestureRecognizer = HorizontalDragGestureRecognizer()
    ..team = _gestureArenaTeam
    ..gestureSettings = gestureSettings
    ..onStart = _dragStart;

  _tapGestureRecognizer = TapGestureRecognizer()..onTapUp = _handleTapUp;

  _gestureArenaTeam.captain = _panGestureRecognizer;

  _paintStrokeStyle = Paint()
    ..color = _strokeColor
    ..strokeWidth = _kMaximumStrokeWidth
    ..strokeCap = StrokeCap.round
    ..style = PaintingStyle.fill
    ..isAntiAlias = true;

  _paintBackgroundStyle = Paint()
    ..color = backgroundColor
    ..style = PaintingStyle.fill
    ..isAntiAlias = true;

  _restrictBezierPathCalculation = _minimumStrokeWidth == _maximumStrokeWidth;
  _data = <List<_TouchPoint>>[];
  _bezierPoints = <_CachePoint>[];
  _lastPoints = <_TouchPoint>[];
  _dotPoints = <Offset>[];
  _pathCollection = <Path>[];
  _currentPath = Path();
  _reset();
}