updateCurrentTemplateWithImage method

void updateCurrentTemplateWithImage(
  1. String imageDataUrl,
  2. int width,
  3. int height
)

Implementation

void updateCurrentTemplateWithImage(
  String imageDataUrl,
  int width,
  int height,
) {
  if (_currentTemplate == null) return;

  final updatedCanvas = _currentTemplate!.canvas.copyWith(
    width: width,
    height: height,
    backgroundImage: imageDataUrl,
  );

  _currentTemplate = _currentTemplate!.copyWith(
    canvas: updatedCanvas,
    ratio: '$width:$height',
  );

  notifyListeners();
}