Skip to content

Why is Marker not a Widget? #2030

@DirtyNative

Description

@DirtyNative

What do you want implemented?

I am not that deep into the code for this package, but I wonder why the Marker class is not a Widget. It would allow us to define and styler the Widget in some other places. Just for an example:

class MyMapMarker extends StatelessWidget {
  final LatLng position;

  const MyMapMarker({
    super.key,
    required this.position,
  });

  @override
  Widget build(BuildContext context) {
    return Marker(
      width: 32,
      height: 32,
      point: position,
      child: Icon(
        Icons.pin,
        size: 32,
        color: Colors.black,
      ),
    );
  }
}

Without extending from a Widget, we need to create a class extending from Marker, and pass the child from the constructor to the Markers constructor. At least thats one way to do.
Or do I oversee something which prevents from being a Widget?

What other alternatives are available?

No response

Can you provide any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P: ∞ (won't add/fix)This bug won't be fixed, or the feature won't be implemented

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions