Skip to content

Flutter Google Map: when having few markers on map, onTap is being activated for the last marker #97966

@yendu

Description

@yendu
short code
markers.value =
           await Future.wait(

              bikeStations.value!.stations!.getRange(0, 5).map((e) async {
            bikeNos++;
            // BitmapDescriptor icon = await getMarkerIcon(
            //     'assets/home/bike.png',
            //     Size(Get.width / 3, Get.width / 3),
            //     "Avail cycle ${e.cycleCount} \nDist ${e.distance}KM");

            BitmapDescriptor? icon = await getCustomIcon(bikeNos);



            return Marker(
              draggable: false,
              consumeTapEvents: false,
            
              onTap: () {
                print("bikeStation onTapped");
                // print(key);


                // bikeInfoDialog(bikeStations.value!.stations![key]);
                bikeInfoDialog(e);
              },
              markerId: MarkerId("${bikeNos}"),
              icon: icon ?? BitmapDescriptor.defaultMarker,
              position: LatLng(
                double.parse(e.lat!),
                double.parse(e.lng!),
              ),
            );
            // subMakers.add(marker);
          }).toList()
flutter doctor -v
[✓] Flutter (Channel stable, 2.10.0, on macOS 11.5.2 20G95 darwin-x64, locale en-ET)
    • Flutter version 2.10.0 at /Users/mac/Downloads/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5f105a6ca7 (6 days ago), 2022-02-01 14:15:42 -0800
    • Engine revision 776efd2034
    • Dart version 2.16.0
    • DevTools version 2.9.2

[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mac/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio Preview.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio Preview.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • iPhone 12 (mobile) • 6B101D18-E8CB-484E-869C-3FB00F44A400 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 98.0.4758.80

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions