ScribbleNotifier constructor

ScribbleNotifier({
  1. Sketch? sketch,
  2. ScribblePointerMode allowedPointersMode = ScribblePointerMode.all,
  3. int maxHistoryLength = 30,
  4. List<double> widths = const [5, 10, 15],
  5. Curve pressureCurve = Curves.linear,
  6. SketchSimplifier simplifier = const VisvalingamSimplifier(),
  7. double simplificationTolerance = 0,
})

The default implementation of a ScribbleNotifierBase.

This class controls the state and behavior for a Scribble widget.

Implementation

ScribbleNotifier({
  /// If you pass a sketch here, the notifier will use that sketch as a
  /// starting point.
  Sketch? sketch,

  /// Which pointers can be drawn with and are captured.
  ScribblePointerMode allowedPointersMode = ScribblePointerMode.all,

  /// How many states you want stored in the undo history, 30 by default.
  int maxHistoryLength = 30,
  this.widths = const [5, 10, 15],
  this.pressureCurve = Curves.linear,
  this.simplifier = const VisvalingamSimplifier(),

  /// {@macro view.state.scribble_state.simplification_tolerance}
  double simplificationTolerance = 0,
}) : super(
        ScribbleState.drawing(
          sketch: switch (sketch) {
            Sketch() => simplifier.simplifySketch(
                sketch,
                pixelTolerance: simplificationTolerance,
              ),
            null => const Sketch(lines: []),
          },
          selectedWidth: widths[0],
          allowedPointersMode: allowedPointersMode,
          simplificationTolerance: simplificationTolerance,
        ),
      ) {
  this.maxHistoryLength = maxHistoryLength;
}