ImagePainter.asset constructor

ImagePainter.asset(
  1. String path, {
  2. required ImagePainterController controller,
  3. Key? key,
  4. double? height,
  5. double? width,
  6. bool? scalable,
  7. Widget? placeholderWidget,
  8. List<Color>? colors,
  9. Widget? brushIcon,
  10. Widget? undoIcon,
  11. Widget? clearAllIcon,
  12. Widget? colorIcon,
  13. ValueChanged<PaintMode>? onPaintModeChanged,
  14. ValueChanged<Color>? onColorChanged,
  15. ValueChanged<double>? onStrokeWidthChanged,
  16. TextDelegate? textDelegate,
  17. bool? controlsAtTop,
  18. bool? showControls,
  19. Color? controlsBackgroundColor,
  20. Color? selectedColor,
  21. Color? unselectedColor,
  22. Color? optionColor,
  23. VoidCallback? onUndo,
  24. VoidCallback? onClear,
})

Constructor for loading image from assetPath.

Implementation

factory ImagePainter.asset(
  String path, {
  required ImagePainterController controller,
  Key? key,
  double? height,
  double? width,
  bool? scalable,
  Widget? placeholderWidget,
  List<Color>? colors,
  Widget? brushIcon,
  Widget? undoIcon,
  Widget? clearAllIcon,
  Widget? colorIcon,
  ValueChanged<PaintMode>? onPaintModeChanged,
  ValueChanged<Color>? onColorChanged,
  ValueChanged<double>? onStrokeWidthChanged,
  TextDelegate? textDelegate,
  bool? controlsAtTop,
  bool? showControls,
  Color? controlsBackgroundColor,
  Color? selectedColor,
  Color? unselectedColor,
  Color? optionColor,
  VoidCallback? onUndo,
  VoidCallback? onClear,
}) {
  return ImagePainter._(
    controller: controller,
    key: key,
    assetPath: path,
    height: height,
    width: width,
    isScalable: scalable ?? false,
    placeHolder: placeholderWidget,
    colors: colors,
    brushIcon: brushIcon,
    undoIcon: undoIcon,
    colorIcon: colorIcon,
    clearAllIcon: clearAllIcon,
    onPaintModeChanged: onPaintModeChanged,
    onColorChanged: onColorChanged,
    onStrokeWidthChanged: onStrokeWidthChanged,
    textDelegate: textDelegate,
    controlsAtTop: controlsAtTop ?? true,
    showControls: showControls ?? true,
    controlsBackgroundColor: controlsBackgroundColor,
    optionSelectedColor: selectedColor,
    optionUnselectedColor: unselectedColor,
    optionColor: optionColor,
    onUndo: onUndo,
    onClear: onClear,
  );
}