|
|
@ -95,9 +95,8 @@ class PushUtils { |
|
|
|
final pictureInfo = await vg.loadPicture(SvgFileLoader(file), null); |
|
|
|
final pictureInfo = await vg.loadPicture(SvgFileLoader(file), null); |
|
|
|
|
|
|
|
|
|
|
|
const largeIconSize = 256; |
|
|
|
const largeIconSize = 256; |
|
|
|
final scale = min(largeIconSize / pictureInfo.size.width, largeIconSize / pictureInfo.size.height); |
|
|
|
final scale = largeIconSize / pictureInfo.size.longestSide; |
|
|
|
final scaledWidth = (pictureInfo.size.width * scale).toInt(); |
|
|
|
final scaledSize = pictureInfo.size * scale; |
|
|
|
final scaledHeight = (pictureInfo.size.height * scale).toInt(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final recorder = PictureRecorder(); |
|
|
|
final recorder = PictureRecorder(); |
|
|
|
Canvas(recorder) |
|
|
|
Canvas(recorder) |
|
|
@ -107,7 +106,7 @@ class PushUtils { |
|
|
|
|
|
|
|
|
|
|
|
pictureInfo.picture.dispose(); |
|
|
|
pictureInfo.picture.dispose(); |
|
|
|
|
|
|
|
|
|
|
|
final image = recorder.endRecording().toImageSync(scaledWidth, scaledHeight); |
|
|
|
final image = recorder.endRecording().toImageSync(scaledSize.width.toInt(), scaledSize.height.toInt()); |
|
|
|
final bytes = await image.toByteData(format: ImageByteFormat.png); |
|
|
|
final bytes = await image.toByteData(format: ImageByteFormat.png); |
|
|
|
|
|
|
|
|
|
|
|
final bitmap = await Bitmap.fromProvider(MemoryImage(bytes!.buffer.asUint8List())); |
|
|
|
final bitmap = await Bitmap.fromProvider(MemoryImage(bytes!.buffer.asUint8List())); |
|
|
|