flutter_google_maps icon indicating copy to clipboard operation
flutter_google_maps copied to clipboard

How to avoid scrolling listview when scrolling in map within listview

Open dhs9004 opened this issue 5 years ago • 2 comments

I have a ListView, at the top of which I have a map, I want the map to scroll out of view when the ListView is scrolled, but I also want the user to be able to interact with the map. So scrolling should only happen when the user scrolls on the other ListView widgets and not when they scroll on the map,

Something like this will be awsome!!

@override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ListView(
        children: <Widget>[
          SizedBox(
            height: MediaQuery.of(context).size.height / 2,
            child: GoogleMap(
              initialCameraPosition:
                  CameraPosition(target: LatLng(41, 29), zoom: 10),
              gestureRecognizers: Set()
                ..add(
                    Factory<PanGestureRecognizer>(() => PanGestureRecognizer()))
                ..add(
                  Factory<VerticalDragGestureRecognizer>(
                      () => VerticalDragGestureRecognizer()),
                )
                ..add(
                  Factory<HorizontalDragGestureRecognizer>(
                      () => HorizontalDragGestureRecognizer()),
                )
                ..add(
                  Factory<ScaleGestureRecognizer>(
                      () => ScaleGestureRecognizer()),
                ),
            ),
          ),
        ],
      ),
    );
  }

I got this from https://stackoverflow.com/a/56197948 Thanks,

dhs9004 avatar Apr 23 '20 23:04 dhs9004

This sample isn't working

march-dev avatar May 10 '20 13:05 march-dev

Please correct me if I am wrong but according Stackoverflow gestureRecognizers solves this issue. However, since this library doesn't have this field, maps inside tab views or any scrollable views are useless .

ulusoyca avatar Sep 22 '20 12:09 ulusoyca