totally new to flutter / android dev.
I have a google map as a tab in a TabBar. A swipe left/right is being grabbed by the tab bar, rather than permitting the user to scroll the map. How can I let the map be scrolled. I've tried various permutations based on the following, but only up and down scrolling currently works.
GoogleMap(
onMapCreated: _controller.complete,
initialCameraPosition: _center,
myLocationButtonEnabled: true,
myLocationEnabled: true,
scrollGesturesEnabled: true,
gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
Factory<OneSequenceGestureRecognizer>(
// () => ScaleGestureRecognizer(),
() => HorizontalDragGestureRecognizer(),
),
].toSet(),
markers: mkMarkers(this.widget.viewModel.restos),
)
Disable the tabBar physics.
Unfortunately this will be for all tabs, but do you want to have scrolling doing different things on different tabs.
TabBarView(
physics: NeverScrollableScrollPhysics(),
...
),
I have also a google map in a tab and I solved this by adding this gestureRecognizers on GoogleMap:
gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
Factory<OneSequenceGestureRecognizer>(
() => EagerGestureRecognizer(),
),
},
Get the imports:
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
And that's it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With