addImage method

void addImage(
  1. Image image
)

Add an image to the current page

Implementation

void addImage(ui.Image image) {
  double aspectRatio = image.width / image.height;
  double width = 150; // Default width
  double height = width / aspectRatio;

  ImageBox newImageBox = ImageBox(
    image: image,
    position: const Offset(100, 100),
    width: width,
    height: height,
  );

  _imageBoxes[_currentPage]!.add(newImageBox);
  _history[_currentPage]!.add(ImageAction(newImageBox, isAdd: true));
  notifyListeners();
}