From 803dddd671e364c14d8ff07a6d168dc98ba5489f Mon Sep 17 00:00:00 2001 From: Alfredo Date: Wed, 16 Apr 2025 14:58:04 +0200 Subject: [PATCH] feat: add loadingBuilder to customize loading widget for static map --- lib/src/widgets/static_map.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/src/widgets/static_map.dart b/lib/src/widgets/static_map.dart index ea1d16e..07627c2 100644 --- a/lib/src/widgets/static_map.dart +++ b/lib/src/widgets/static_map.dart @@ -82,6 +82,11 @@ class StaticMap extends StatelessWidget { /// pixel ratio final bool scaleToDevicePixelRatio; + /// The loadingBuilder is used to show a loading widget while the image is being loaded. + /// It is called with the context, the image widget, and the ImageChunkEvent. + /// The image widget is passed to the loadingBuilder so that you can customize + final Widget Function(BuildContext, Widget, ImageChunkEvent?)? loadingBuilder; + const StaticMap({ Key? key, required this.googleApiKey, @@ -101,6 +106,7 @@ class StaticMap extends StatelessWidget { this.signature, this.styles, this.scaleToDevicePixelRatio = true, + this.loadingBuilder, }) : super(key: key); @override @@ -143,6 +149,7 @@ class StaticMap extends StatelessWidget { width: width, height: height, fit: BoxFit.contain, + loadingBuilder: loadingBuilder, ); }, ),