Skip to content

[Bug]: can not set map style with GoogleNavigationViewController after using navigation once in iOS #436

@Ghelwig

Description

@Ghelwig

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

when initializing the map view, I am able to switch between different themes using setMapStyle. Once I start navigation, it goes back to the default map style. Looking into this issue more it sounds like custom map styles are not supported with navigation yet (atleast on iOS, it seems to allow you on Android). While this is not an issue, even after cleaning up the navigation session setMapStyle will never work until you re-initialize the entire widget. This is now how it works on Android, after ending the navigation session you are able to switch the theme back to what it was before the session started.

This is an issue when trying to implement dark modes.

Flutter version

3.29.3

Package version

0.4.0-0.6.3

Native SDK versions

  • I haven't changed the version of the native SDKs

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.29.3, on macOS 14.6.1 23G93 darwin-arm64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Xcode - develop for iOS and macOS (Xcode 16.0)
! CocoaPods 1.15.2 out of date (1.16.2 is recommended).
CocoaPods is a package manager for iOS or macOS platform code.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/to/platform-plugins
To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.97.2)
[✓] Connected device (5 available)
! Error: Browsing on the local area network for Grant’s iPad. Ensure the device is unlocked and attached with a cable or associated with the same local
area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

! Doctor found issues in 2 categories.

Steps to reproduce

  1. initialize the GoogleMapsNavigationView widget in your app
  2. use setMapStyle with the GoogleNavigationViewController freely
  3. intialize and clean up any navigation session
  4. observe that setMapStyle will no longer work after the session has ended

Expected vs Actual Behavior

Expected Behavior:
you are able to update the map style while a navigation session is not active

Actual Behavior:
after initializing a navigation session once, you are unable to update the map style anymore

Code Sample

final themeJson = (await rootBundle.loadString(
'packages/lou_assets/assets/dark_mode.json',
));

  await navController?.setMapStyle(themeJson);

Additional Context

As mentioned before this seems OS specific. I have tried clearing navigation and the map controller before setting map style again and nothing has worked.

Metadata

Metadata

Assignees

Labels

feature requestNew feature or requestpriority: p2Moderately-important priority. Fix may not be included in next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions