Skip to content

[Bug]: Map Padding Behavior #478

@SabirHalil

Description

@SabirHalil

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Currently, when I call setPadding on the map controller, the map view itself correctly adjusts. However, the turn-by-turn navigation UI elements (such as the remaining time, destination panel, or navigation instructions) are not affected by the padding.

This causes those elements to overlap with other parts of the UI, especially when I want to add custom widgets on top of the map.

👉 My question: How can I adjust the padding so that navigation UI elements (time, destination, instructions, etc.) also respect the defined padding?

Image

Flutter version

3.32.5

Package version

0.6.4

Native SDK versions

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

Flutter Doctor Output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.5, on macOS 15.3.2 24D81 darwin-arm64, locale en-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.1)
[✓] VS Code (version 1.104.0)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

Steps to reproduce

Just run the provided code.

Expected vs Actual Behavior

After calling setPadding, the map camera and navigation UI elements should adjust to avoid overlapping with other UI or custom widgets, but currently, while the map camera respects the padding, the navigation UI elements remain fixed to the screen edge and overlap with overlays and the map's inset region.

Code Sample

  Future<void> onViewCreated(GoogleNavigationViewController controller) async {
    navigationViewController = controller;
    await controller.setMyLocationEnabled(true);
    if (userLocation.value == null) {
      final loc = await controller.getMyLocation();
      if (loc != null) userLocation.value = loc;
    }
    await navigationViewController?.setSpeedLimitIconEnabled(true);
    await navigationViewController?.setReportIncidentButtonEnabled(false);
    await navigationViewController?.setSpeedometerEnabled(true);
    await navigationViewController?.setPadding(EdgeInsets.only(top: 100, bottom: 150));
    if (Platform.isAndroid) {
      await navigationViewController?.settings.setZoomControlsEnabled(true);
    }
  }


  Future<void> startNavigation() async {
    if (!validRoute.value) return;
    await navigationViewController?.setNavigationUIEnabled(true);
    await GoogleMapsNavigator.startGuidance();
    await navigationViewController?.setPadding(EdgeInsets.only(top: 100, bottom: 150));
    await navigationViewController?.followMyLocation(CameraPerspective.tilted);
    guidanceRunning.value = true;
  }

Additional Context

No response

Metadata

Metadata

Assignees

Labels

priority: 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