flutter_map icon indicating copy to clipboard operation
flutter_map copied to clipboard

pinchZoom and pinchMove are insensitive when a FlutterMap disable InteractiveFlag.drag and place inside a scrollable widget

Open YanhqZ opened this issue 8 months ago • 2 comments

What is the bug?

When I wrap a FlutterMap widget inside a scrollable parent, such as ListView or SingleChildScrollView, we should disable FlutterMap single finger gesture to ensure the page scroll behavior。 but the problem is the multiple fingers gesture such as pinchZoom seems to be affected and become insensitive. and if i remove the scrollable parent, the multiple fingers gesture is sensitive!

How can we reproduce it?

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              width: double.infinity,
              height: 300,
              alignment: Alignment.center,
              color: Colors.blue,
              child: const Text(
                'List Tile1',
                style: TextStyle(fontSize: 24),
              ),
            ),
            SizedBox(
              width: double.infinity,
              height: 400,
              child: FlutterMap(
                options: const MapOptions(
                    initialCenter: LatLng(51.5, -0.09),
                    initialZoom: 5,
                    interactionOptions: InteractionOptions(
                      flags: InteractiveFlag.all & ~InteractiveFlag.drag,
                    )),
                children: [
                  TileLayer(
                    urlTemplate:
                        'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
                    userAgentPackageName:
                        'dev.fleaflet.flutter_map.example',
                  ),
                ],
              ),
            ),
            Container(
              width: double.infinity,
              height: 300,
              alignment: Alignment.center,
              color: Colors.blue,
              child: const Text(
                'List Tile 2',
                style: TextStyle(fontSize: 24),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Do you have a potential solution?

No response

YanhqZ avatar May 20 '25 08:05 YanhqZ

any update?

YanhqZ avatar May 29 '25 01:05 YanhqZ

Hi, thanks for the report. I can reproduce this. Getting the behaviour right with parent scrollables is always tricky since we use some quite low-level techniques, but we'll try to look into it. PRs appreciated!

JaffaKetchup avatar May 30 '25 10:05 JaffaKetchup