-
-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Cannot Pan Vertically Inside ListView
#1308
Comments
what version of FlutterMap are you using, and is the example modified at all with any other code ? |
I confirm. I have the same problem. Inside SingleChildScrollView doesn't work either |
What version of FlutterMap are you using, and is it the default listview example unmodified ? |
I am using the default ListView/SingleChildScrollView. My problem is described here https://stackoverflow.com/questions/61744359/google-maps-inside-a-form-in-singlechildscrollview . Is there any solution to this problem for this library? Flutter 3.0.2. |
You are using GoogleMap not FlutterMap. |
I am using flutter_map. I gave this as an example that is also in flutter_map for me. |
What version of flutter_map are you using, and are you using the listview example in the examples folder to test ? |
Not sure if relevant, but wasn't there that options property about scrolling and patent widget or something like that |
allowPanningOnScrollingParent: false, in MapOptions maybe ? It may be relevant, hard to tell without more info |
The code I use is the same as in the examples.
https://www.youtube.com/watch?v=YkZliaZm6Zk flutter_map: ^2.0.0 |
What about if you put flutter_map inside an AbsorbPointer....eg
|
I am using 2.0.0 version. The problem occurs in Android Physics and emulator device, in iOS simulator works as expected. I don't change any things in example code. Just clone and run. |
Does not work. |
How about an IgnorePointer ? |
I think AbsorbPointer and IgnorePointer has no sense, because some widget lost the scroll property (and tap property). The objective is map with scroll (vertical and horizontal) and remain the ListView scroll but only out of map tap. |
Doesn't work either. With AbsorPointer and IgnorePointer map does not respond to touches. |
I haven't tested on IOS, but it doesn't work on the web either. |
Yes, I suspect I was misunderstanding the initial problem in part. |
Just updating, doesn't work on Android Emulator either. |
This functionality seems to work for me, considering I've just been testing #1293, which directly deals with maps in a list. See if this code works for you: import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart' show LatLng;
void main() {
runApp(const MaterialApp(
title: 'Flutter Demo',
home: MyHomePage(),
));
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Map in a ListView'),
),
body: ListView(children: [
SizedBox(
height: 100.0,
child: FlutterMap(
options: MapOptions(
center: LatLng(50, 30),
zoom: 13,
allowPanningOnScrollingParent: false,
),
layers: [
TileLayerOptions(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
),
],
),
),
for (int i = 1; i < 30; i++)
Padding(
padding: const EdgeInsets.all(20.0),
child: Center(child: Text('Line $i', style: const TextStyle(fontSize: 20))),
),
]),
);
}
} |
Hi @JaffaKetchup. Thank for your response but doesn't work either. Horizontal scroll works fine but vertical scroll keep scrolling the ListView not the map. Also this example throw an error when I scroll to Botton and try to pan the map ( |
Yeah, that error will be fixed in v2.1.0, which is what that PR was about. I do see what you mean though. If you pan horizontally, then vertically, it works fine, but if you try to just do vertical, it doesn't seem to work. |
Is there an older version in which this functionality seemed to work? |
@JaffaKetchup sorry is my first time with flutter map. Grabacion.de.pantalla.2022-07-20.a.la.s.4.26.42.p.m.-1.mov |
No problem, this is unusual behaviour, so please don't be put off. There should not be platform specific behaviour like this, so I'm wondering if it's an issue elsewhere? Looking through our gesture detection code, however, it looks like it could be improved, as there's essentially 3 nested detectors which probably aren't playing nice together. However, in this case, all platforms should behave the same way, so I don't think this is the issue. Thanks for the report, we will need to look further into this :) |
May I ask what your use-case for using a map inside a list is? We usually recommend you don't do this because it restricts the size of the map, which usually needs to be quite big to display much useful information. Maybe we can find a temporary alternative design? |
ListView
Thanks I understand. We use a Scroll (Column inside a SingleChildScrollView) where we show several elements, one of them is the map (the user can scroll vertically at will to work on any of the elements). For now we will have to modify the design to avoid this issue (or maybe use some workaround with the scroll physics). Thank you for your attention. I'll be waiting for any solution. 👍🏼 |
Any update around that? |
Unfortunately not. I haven't had much of a look into this, as I'm not very experienced in this part. |
Adding this to EagerGestureRecognizer:
GestureRecognizerFactoryWithHandlers<EagerGestureRecognizer>(
() => EagerGestureRecognizer(),
(EagerGestureRecognizer instance) {
scaleGestureTeam.captain = instance;
instance.team ??= scaleGestureTeam;
},), |
Hi, same problem on Android here. Tested with flutter map |
Thanks for the input @alejandrogiubel & @selankon. Right now, we're not looking at a fix, but it does need to be fixed. |
$300 bounty to whoever can fix this (without breaking other things, of course.) Source |
This issue has already been fixed in a development fork. |
Describe The Bug
Map inside ListView example not works as expected in android device.
Expected Behavior
Map scroll does not scroll the list view
Screenshots & Recordings
WhatsApp.Video.2022-07-17.at.6.49.40.PM.mp4
Doctors Report
To Reproduce
Run the example app
Severity
This will help us to label the issue quicker and decide what needs attention first. Only choose fatal if the entire app crashes, otherwise choose non-fatal.
Frequency/Rarity
This will help us to label the issue quicker and decide what needs attention first.
Applicable Platforms
Only select those that you've tested on - one or more. If possible, test on a variety of platforms.
The text was updated successfully, but these errors were encountered: