Skip to content

back button does not work on top of google map #28920

@bogdannedelcu

Description

@bogdannedelcu

Steps to Reproduce

The app contains a StatefulWidget with Scaffold having Drawer and GoogleMap plugin.

Steps to reproduce:

  1. Inside GoogleMap add two markers.
  2. Set initialCamera to some random coordinates.
  3. Open the drawer
  4. Tap to open new page
  5. Minimize app
  6. Open app and try pushing back, not working
  7. Back button eventually works if you minimize again

See movie back_button_doesnt_work.MOV

I see it happen only on iOS.

link to source code and recorded video: https://drive.google.com/drive/folders/1_oaZLIAqFQ82Eg_Gcn9X0I59Vto3TR5k?usp=sharing

Logs

flutter run --verbose
does not produce any logs after starting the app on iPhone

flutter analyze
does not return any issues

Not sure if we used properly the plugin.
Thank you for helping with this issue.

flutter doctor -v

[✓] Flutter (Channel master, v1.2.3-pre.50, on Mac OS X 10.14 18A391, locale en-GB)
    • Flutter version 1.2.3-pre.50 at /Users/bogdannedelcu/Developpment/flutter
    • Framework revision f460dd60df (in the future), 2019-02-26 08:08:28 -0500
    • Engine revision 9f95ef23aa
    • Dart version 2.2.0 (build 2.2.0-dev.2.1 f7e435ac26)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/bogdannedelcu/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
    • 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
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • Hipp • 2b1aea516796a71aec47f891c6f8cb7f70dc797c • ios • iOS 12.1.4

! Doctor found issues in 1 category.

main file is bellow:

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:maps_testing/new_screen.dart';

class MapScreen extends StatefulWidget {
  @override
  _MapScreenState createState() => _MapScreenState();
}

class _MapScreenState extends State<MapScreen> {
  GoogleMapController mapController;
  var _scaffoldKey = GlobalKey<ScaffoldState>();

  bool markersVisible = true;

  String error;


  @override
  Widget build(BuildContext context) {
    double _screenWidth = MediaQuery.of(context).size.width;
    double _screenHeight = MediaQuery.of(context).size.height;
    return Scaffold(
        key: _scaffoldKey,
        drawer: Drawer(
          child: GestureDetector(
            behavior: HitTestBehavior.opaque,
            child: Center(
              child: Text('Press anywhere to test the bug'),
            ),
            onTap: () {
              Navigator.pop(context);
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => NewScreen(),
                ),
              );
            },
          ),
        ),
        body: Stack(children: <Widget>[
          Align(
            alignment: Alignment.topCenter,
            child: SizedBox(
              width: _screenWidth,
              height: _screenHeight,
              child: GoogleMap(
                trackCameraPosition: true,
                initialCameraPosition: CameraPosition(
                  bearing: 0.0,
                  target: LatLng(48.8566,2.3522),
                  tilt: 0.0,
                  zoom: 18.0,
                ),
                mapType: MapType.normal,
                onMapCreated: _onMapCreated,
                tiltGesturesEnabled: false,
                compassEnabled: false,
              ),
            ),
          ),

        ]));
  }

  void _onMapCreated(GoogleMapController controller) {
    _showMarkers(markersVisible, controller);

//    setState(() {});
  }



  void _showMarkers(bool flag, GoogleMapController controller) {
    if (flag == true) {
      setState(() {
        mapController = controller;
        mapController.clearMarkers();
        mapController.onMarkerTapped.add((marker) {
          setState(() {});
        });

        mapController.addMarker(
          MarkerOptions(
              position: LatLng(44.496113, 26.131699),
              infoWindowText:
              InfoWindowText("Mega Image", "Strada George Bacovia"),
              icon: BitmapDescriptor.defaultMarkerWithHue(
                  BitmapDescriptor.hueGreen),
              consumeTapEvents: false),
        );

        mapController.addMarker(
          MarkerOptions(
              position: LatLng(44.4110224, 26.0712143),
              infoWindowText:
              InfoWindowText("Mega Image", "Bulevardul Lacul Tei"),
              icon: BitmapDescriptor.defaultMarkerWithHue(
                  BitmapDescriptor.hueGreen),
              consumeTapEvents: false),
        );
      });
    }
  }
}

Metadata

Metadata

Assignees

Labels

p: mapsGoogle Maps pluginplatform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions