Home > Mobile >  GoogleMap card in Column in SingleChildScrollView
GoogleMap card in Column in SingleChildScrollView

Time:01-15

I am using the GoogleMap Widget from the google_maps_flutter package. I have placed the GoogleMap widget in SizedBox with width and height of 300 in a Column with other children. I have placed the Column in a SingleChildScrollView because there are many children. When the Column doesn't use the SingleChildScrollView, there is no problem. But when there are enough children so that scrolling is necessary, the GoogleMap widget becomes impossible to zoom in or pan (move the viewport) with gestures.

CodePudding user response:

Google map in Flutter not responding to touch events

Solution snippet:

gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
          Factory<OneSequenceGestureRecognizer>(
            () => EagerGestureRecognizer(),
          ),
        },

CodePudding user response:

To include a GoogleMap card in a Column inside a SingleChildScrollView in Flutter, you can use the following code snippet:

SingleChildScrollView(
  child: Column(
    children: <Widget>[
      Container(
        height: 300,
        width: double.infinity,
        child: GoogleMap(
          initialCameraPosition: CameraPosition(
            target: LatLng(37.4219999,-122.0840575),
            zoom: 10
          ),
        ),
      ),
      // Other widgets in the Column
    ],
  ),
),
  • Related