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,
})

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,

  /// The supported widths, mainly useful for rendering UI, you can still set
  /// the width to any arbitrary value from code. The first entry in this list
  /// will be the starting width.
  this.widths = const [5, 10, 15],

  /// The curve that's used to map pen pressure to the pressure value when
  /// recording, by default it's linear.
  this.pressureCurve = Curves.linear,
}) : super(
        ScribbleState.drawing(
          sketch: sketch ?? const Sketch(lines: []),
          selectedWidth: widths[0],
          allowedPointersMode: allowedPointersMode,
        ),
      ) {
  value = ScribbleState.drawing(
    sketch: sketch ?? const Sketch(lines: []),
    selectedWidth: widths[0],
    allowedPointersMode: allowedPointersMode,
  );
  this.maxHistoryLength = maxHistoryLength;
}