Pedro Lopes
Pedro Lopes

Reputation: 41

Is there a way to hide street names (google_maps_flutter)?

I'm working on an app, and want to display a map without street names.

Is there any way to disable the street names?

Upvotes: 2

Views: 1856

Answers (2)

mohammad mowludi
mohammad mowludi

Reputation: 21

go to https://mapstyle.withgoogle.com/ and make your own style you can set : Roads Landmarks Labels Select theme and set style to the map.

Upvotes: -1

Vineet
Vineet

Reputation: 1209

Google maps for flutter now has the ability to customise styling of maps. Go to Google Maps Styling Wizard, reduce the road density and generate the JSON.

Copy the generated JSON to your assets folder and specify it in your pubspec.yaml file. If your folder is called assets:

flutter:  
  assets:
    - assets/no_street_names.json

Now, you just need to use this style in your created maps. It can be achieved by setting map style with map's controller. You can use the following code for reference:

import 'package:flutter/services.dart' show rootBundle;
GoogleMap(
          onMapCreated: (GoogleMapController controller) {
            rootBundle.loadString('assets/no_street_names.json').then((String mapStyle) {
              controller.setMapStyle(mapStyle);
            });
          },
        ),

Upvotes: 6

Related Questions