8000 InteractiveViewer scrolling scales both the map and the viewport · Issue #2065 · fleaflet/flutter_map · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
InteractiveViewer scrolling scales both the map and the viewport #2065
Open
@scw67

Description

@scw67

What is the bug?

When including a FlutterMap inside an InteractiveViewer widget I would expect that scrolling inside the FlutterMap only triggers the scale handler of the map but it seems like the event its not fully consumed and bubbles up to the InteractiveViewer, triggering both handlers. The net result is that the map scales but also does the InteractiveViewer viewport.

Expected behaviour: when scrolling on a FlutterMap inside an InteractiveViewer, only the FlutterMap get scaled, without affecting the InteractiveViewer viewport.

versions used:
flutter 3.24.4
flutter_map 7.0.2

How can we reproduce it?

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text("PoC")),
        body: const PoC(),
      )
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: 1000,
      height: 1000,
      child: Container(
        decoration: BoxDecoration(
          border: Border.all(color: Colors.black)
        ),
        child: InteractiveViewer(
          child: Stack(
5E64

            children: [
              Container(
                width: 50,
                height: 50,
                color: const Color(0xffff0000),
              ),
              Positioned(
                left: 200,
                top: 200,
                child: SizedBox(
                  width: 100,
                  height: 100,
                  child: FlutterMap(
                    options: const MapOptions(
                      initialCenter: LatLng(51.385080, 0.165709),
                      interactionOptions: InteractionOptions(
                        flags: InteractiveFlag.all & ~InteractiveFlag.rotate,
                      ),
                    ),
                    children: [
                      TileLayer(
                        urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
                        userAgentPackageName: 'test.test.poc',
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Do you have a potential solution?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis new bug report needs reproducing and prioritizing

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0