withInkLines method

AnnotationProperties withInkLines(
  1. List<List<Offset>> lines
)

Creates a modified copy with updated ink lines. Accepts a list of lines where each line is a list of Offset points. Points are converted to x, y, pressure format with default pressure of 1.0.

Implementation

AnnotationProperties withInkLines(List<List<Offset>> lines) {
  final serializedLines = lines.map((line) {
    return line.map((point) {
      return [point.dx, point.dy, 1.0]; // x, y, pressure (default to 1.0)
    }).toList();
  }).toList();

  return AnnotationProperties(
    annotationId: annotationId,
    pageIndex: pageIndex,
    strokeColor: strokeColor,
    fillColor: fillColor,
    opacity: opacity,
    lineWidth: lineWidth,
    flagsJson: flagsJson,
    customDataJson: customDataJson,
    contents: contents,
    subject: subject,
    creator: creator,
    bboxJson: bboxJson,
    note: note,
    inkLinesJson: _encodeInkLines(serializedLines),
    fontName: fontName,
    fontSize: fontSize,
    iconName: iconName,
  );
}