From 5dd409ea7a9b69eb87425928a4079f58fbdb347d Mon Sep 17 00:00:00 2001 From: yukitaka13-1110 Date: Tue, 22 Aug 2023 16:57:27 +0900 Subject: [PATCH] feat: add `pixelRatio` parameter to `widgetToIcon` function --- lib/marker_icon.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/marker_icon.dart b/lib/marker_icon.dart index 05ba8ef..1572128 100644 --- a/lib/marker_icon.dart +++ b/lib/marker_icon.dart @@ -205,9 +205,9 @@ class MarkerIcon { return BitmapDescriptor.fromBytes(data!.buffer.asUint8List()); } - static Future widgetToIcon(GlobalKey globalKey) async { + static Future widgetToIcon(GlobalKey globalKey, {double pixelRatio = 1.0}) async { RenderRepaintBoundary boundary = globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary; - ui.Image image = await boundary.toImage(); + ui.Image image = await boundary.toImage(pixelRatio: pixelRatio); ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png); return BitmapDescriptor.fromBytes(byteData!.buffer.asUint8List()); }