albert-heijn-technology / platform_maps_flutter

A Flutter package to provide the native maps to Android/iOS
BSD 2-Clause "Simplified" License
78 stars 65 forks source link

IOS: onTap function never gets called for InfoWindow onTap #14

Closed fbazbo closed 3 years ago

fbazbo commented 4 years ago

Basically used the example with the controller Future removed and an onTap event added to InfoWindow


import 'package:platform_maps_flutter/platform_maps_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
//        width: 300,
//        height: 300,
        child: PlatformMap(
          initialCameraPosition: CameraPosition(
            target: const LatLng(47.6, 8.8796),
            zoom: 16.0,
          ),
          markers: Set<Marker>.of(
            [
              Marker(
                markerId: MarkerId('marker_1'),
                position: LatLng(47.6, 8.8796),
                consumeTapEvents: true,
                infoWindow: InfoWindow(
                  title: 'PlatformMarker',
                  snippet: "Hi I'm a Platform Marker",
                  onTap: () {
                    print('InfoWindow tapped');
                  }
                ),
                onTap: () {
                  print("Marker tapped");
                },
              ),
            ],
          ),
          mapType: MapType.satellite,
          onTap: (location) => print('onTap: $location'),
          onCameraMove: (cameraUpdate) => print('onCameraMove: $cameraUpdate'),
          compassEnabled: true,
          onMapCreated: (controller) {
          },
        ),
      ),
    );
  }
}

Also, is there any way to display the InfoWindow programmatically? Or at least a property indicating if its displayed at render time or not... thanks... this is a really useful map plugin so keep up the good work...

LuisThein commented 4 years ago

Hey, I think the Marker actions in the MkMapView need a rework, I will look into it.

fbazbo commented 4 years ago

Thanks for investigating... This is less important since a custom InfoWindow would likely be more useful and I've gone with a bottomSheet to provide more marker info and actions as an alternative.

speedlightwp commented 3 years ago

Hi, able to rectify the infowindow ontap for IOS? I need this feature to redirect user to Apple map on their device. Thank you very much 🙏

LuisThein commented 3 years ago

I will start development for the apple_maps_flutter annotations rework, but I'm not sure how long that will take.