Skip to content

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

Open
@YanhqZ

Description

@YanhqZ

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P: 3 (low)(Default priority for feature requests)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions