Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[google_maps_flutter] Custom icons do not work on iOS #28648

Closed
sam-toon opened this issue Feb 28, 2019 · 4 comments
Closed

[google_maps_flutter] Custom icons do not work on iOS #28648

sam-toon opened this issue Feb 28, 2019 · 4 comments
Assignees
Labels
c: regression It was better in the past than it is now p: maps Google Maps plugin package flutter/packages repository. See also p: labels.

Comments

@sam-toon
Copy link

Steps to Reproduce

I am using google_maps_flutter and want to use a custom icon for the marker. This works on Android, but on iOS it just displays the default marker. I get the following messages in the log when I click on the button to add the marker.

Sample code is supplied below - you will need to provide a bitmap file for the marker.

This is with google_maps_flutter version 0.3.0+1

I have tried the dev and master channels and the problem still exists.

This works in google_map_flutter 0.2.0, when the markers were part of the map controller.

Logs

[+11552 ms] [DEVICE LOG] 2019-02-28 12:41:37.702608+0000  localhost Runner[92988]: (CoreUI) [com.apple.coreui:framework] CUICatalog:
Invalid asset name supplied: '(null)'
[        ] [DEVICE LOG] 2019-02-28 12:41:37.702658+0000  localhost Runner[92988]: (CoreUI) [com.apple.coreui:framework] CUICatalog:
Invalid asset name supplied: '(null)'
[        ] [DEVICE LOG] 2019-02-28 12:41:37.703070+0000  localhost Runner[92988]: (CoreUI) [com.apple.coreui:framework] CUIThemeStore:
No theme registered with id=0

Code

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Google Maps Demo',
      home: MapSample(),
    );
  }
}

class MapSample extends StatefulWidget {
  @override
  State<MapSample> createState() => MapSampleState();
}

class MapSampleState extends State<MapSample> {
  Completer<GoogleMapController> _controller = Completer();
  Map<MarkerId, Marker> markers = <MarkerId, Marker>{};

  static final CameraPosition _kGooglePlex = CameraPosition(
    target: LatLng(37.42796133580664, -122.085749655962),
    zoom: 14.4746,
  );

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: GoogleMap(
        mapType: MapType.hybrid,
        initialCameraPosition: _kGooglePlex,
        markers: Set<Marker>.of(markers.values),
        onMapCreated: (GoogleMapController controller) {
          _controller.complete(controller);
        },
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: _addMarker,
        label: Text('Add Marker'),
        icon: Icon(Icons.place),
      ),
    );
  }

  Future<void> _addMarker() async {
    //final GoogleMapController controller = await _controller.future;
    final MarkerId markerId = MarkerId('test_marker');
    final Marker marker = Marker(
      markerId: markerId,
      anchor: Offset(0.5, 0.5),
      icon: BitmapDescriptor.fromAsset('assets/marker.png'),
      position: LatLng(
        37.42796133580664,
        -122.085749655962,
      ),
      infoWindow: InfoWindow.noText,
      zIndex: 5,
    );

    setState(() {
      markers[markerId] = marker;
    });
  }
}

[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-GB)
    • Flutter version 1.2.1 at /Users/samtoon/flutter
    • Framework revision 8661d8aecd (13 days ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/samtoon/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/samtoon/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    ✗ Verify that all connected devices have been paired with this computer in Xcode.
      If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
      To update with Brew, run:
        brew update
        brew uninstall --ignore-dependencies libimobiledevice
        brew uninstall --ignore-dependencies usbmuxd
        brew install --HEAD usbmuxd
        brew unlink usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.0.rc.2

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 33.3.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] VS Code (version 1.31.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.24.0

[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.
@sam-toon sam-toon changed the title Custom icons do not work on iOS [google_maps_flutter] Custom icons do not work on iOS Feb 28, 2019
@iskakaushik iskakaushik self-assigned this Feb 28, 2019
@iskakaushik
Copy link
Contributor

Hi @sam-toon, thanks for flagging this. I will take a look.

@iskakaushik iskakaushik added plugin p: maps Google Maps plugin c: regression It was better in the past than it is now labels Feb 28, 2019
@iskakaushik
Copy link
Contributor

Will be addressed in flutter/plugins#1294

@iskakaushik
Copy link
Contributor

This is addressed by 0.3.0+2. Please try that version. Thanks!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2021
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now p: maps Google Maps plugin package flutter/packages repository. See also p: labels.
Projects
None yet
Development

No branches or pull requests

2 participants