diff --git a/packages/neon/neon/lib/neon.dart b/packages/neon/neon/lib/neon.dart index d8011d1c..da10472b 100644 --- a/packages/neon/neon/lib/neon.dart +++ b/packages/neon/neon/lib/neon.dart @@ -3,7 +3,6 @@ library neon; import 'dart:async'; import 'dart:convert'; import 'dart:io'; -import 'dart:math'; import 'dart:ui'; import 'package:bitmap/bitmap.dart'; diff --git a/packages/neon/neon/lib/src/utils/push_utils.dart b/packages/neon/neon/lib/src/utils/push_utils.dart index 9aa3d676..d9b9c4b5 100644 --- a/packages/neon/neon/lib/src/utils/push_utils.dart +++ b/packages/neon/neon/lib/src/utils/push_utils.dart @@ -95,9 +95,8 @@ class PushUtils { final pictureInfo = await vg.loadPicture(SvgFileLoader(file), null); const largeIconSize = 256; - final scale = min(largeIconSize / pictureInfo.size.width, largeIconSize / pictureInfo.size.height); - final scaledWidth = (pictureInfo.size.width * scale).toInt(); - final scaledHeight = (pictureInfo.size.height * scale).toInt(); + final scale = largeIconSize / pictureInfo.size.longestSide; + final scaledSize = pictureInfo.size * scale; final recorder = PictureRecorder(); Canvas(recorder) @@ -107,7 +106,7 @@ class PushUtils { 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 bitmap = await Bitmap.fromProvider(MemoryImage(bytes!.buffer.asUint8List()));