loadMediaAndImage method
dynamic
loadMediaAndImage()
Implementation
loadMediaAndImage() async {
if (widget.xMedia != null) {
//carichiamo i payloads se uno รจ vuoto
if (widget.xMedia!.payload == null) {
await widget.loadMedia!(widget.xMedia);
} else {}
if (widget.xMedia!.payload != null) {
widget.backImage = Image.memory(
widget.xMedia!.payload!,
// height: MediaQuery.of(context).size.height / 2,
// width: MediaQuery.of(context).size.width / 2,
);
}
// var ii = widget.backImage.image as MemoryImage;
if (widget.xMedia!.overlaySurface == null) {
if (widget.xMedia!.payload != null) {
_image = await createTransparentImage_fromPayLoad(widget.xMedia!.payload!);
} else {
_image = await createTransparentImage(widget.width!.toInt(), widget.height!.toInt());
}
} else {
_image = await _convertTo_UiImage(widget.xMedia!.overlaySurface!);
}
if (_image == null) {
throw ("Image couldn't be resolved from xMedia!.overlaySurface.");
} else {
isBusy = false;
_setStrokeMultiplier();
}
} else {
// if (widget.payload == null) {
_image = await createTransparentImage((widget.signature_Width?.toInt() ?? widget.width!.toInt()), (widget.signature_Height?.toInt() ?? widget.height!.toInt()));
// } else {
// _image = await _convertTo_UiImage(widget.payload!);
// }
if (_image == null) {
throw ("Image couldn't be resolved from xMedia!.overlaySurface.");
} else {
isBusy = false;
_setStrokeMultiplier();
}
}
_isLoaded.value = true;
_controller.naturalSize = imageSize;
_controller.update(
mode: PaintMode.none,
color: Colors.black,
);
_textController = TextEditingController();
_transformationController_Payload = TransformationController();
_transformationController_Overlay = TransformationController();
textDelegate = widget.textDelegate ?? TextDelegate();
_isLoaded.value = true;
if (widget.isNewNota) {
modifiedActive = true;
_controller.setMode(PaintMode.freeStyle);
}
if (widget.readOnly) {
modifiedActive = false;
_controller.setMode(PaintMode.none);
}
}