DrawingPadController constructor

DrawingPadController({
  1. bool? usePerfectFreehand,
  2. GlobalKey<State<StatefulWidget>>? canvasKey,
  3. Color? backgroundColor,
})

Initializes a new instance of the DrawingPadController class.

usePerfectFreehand determines whether to use the perfect_freehand package.

Implementation

DrawingPadController({
  bool? usePerfectFreehand,
  GlobalKey? canvasKey,
  Color? backgroundColor,
}) {
  this.canvasKey = canvasKey ?? GlobalKey();
  this.backgroundColor = backgroundColor ?? Colors.white;

  if (usePerfectFreehand != null) {
    this.usePerfectFreehand = usePerfectFreehand;
  }

  undoRedoStack = UndoRedoStack(
    strokesNotifier: strokesListenable,
    currentStrokeNotifier: currentStrokeListenable,
  );
}