widget_to_marker 0.0.1+1 copy "widget_to_marker: ^0.0.1+1" to clipboard
widget_to_marker: ^0.0.1+1 copied to clipboard

convert Widgets To BitmapDescriptor

Features #

this package allow you to use .toBitmapDescriptor() function on widget to Convert it to use it as a marker icon !

Getting started #

Add dependency #

dependencies:
  widget_to_marker: ^0.0.1

1 - Create Your Widget To Make it as Marker: #

class TextOnImage extends StatelessWidget {
  const TextOnImage({
    super.key,
    required this.text,
  });
  final String text;
  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: Alignment.center,
      children: [
        Image(
          image: const AssetImage(
            "assets/marker.png",
          ),
          height: 150,
          width: 150,
        ),
        Text(
          text,
          style: TextStyle(color: Colors.black),
        )
      ],
    );
  }
}

2 - Add it to the marker with .toBitmapDescriptor(): #

Marker(
      markerId: const MarkerId("3"),
      position: const LatLng(30.01124477440843, 30.78459296375513),
      icon: await TextOnImage(
        text: "Hello World",
      ).toBitmapDescriptor(),
    )

Note #

You Can Use waitToRender Attribute to set duration for rendering large network and asset images

Enjoy!! #

image

67
likes
0
pub points
95%
popularity

Publisher

unverified uploader

convert Widgets To BitmapDescriptor

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, google_maps_flutter

More

Packages that depend on widget_to_marker