79199417

Date: 2024-11-18 09:53:12
Score: 0.5
Natty:
Report link

You are right on your assumption, the bottom sheet is capturing the gestures and does not allow the map to take over them.

Did you try to use a GestureDetector to resolve it? Something like this:

void showLocationSelection(
  BuildContext context,
  ThemeData theme,
  CommonColorsExt? commonColors,
  MerchantQuestionsViewModel viewModel,
) {
  showModalBottomSheet(
    context: context,
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.vertical(
        top: Radius.circular(16.0),
      ),
    ),
    isScrollControlled: true,
    builder: (BuildContext context) {
      return GestureDetector(
        onTap: () {
          FocusScope.of(context).unfocus(); // Dismiss keyboard
        },
        child: Container(
          constraints: BoxConstraints(
            maxHeight: MediaQuery.of(context).size.height * 0.9,
          ),
          child: Column(
            children: [
              Expanded(
                child: GestureDetector(
                  onVerticalDragUpdate: (_) {}, // Prevents bottom sheet gestures
                  child: GoogleMap(
                    initialCameraPosition: CameraPosition(
                      target: LatLng(6.91177, 79.85043),
                      zoom: 15.0,
                    ),
                    onTap: (LatLng position) {
                      viewModel.setGeoLocation(position);
                    },
                    markers: viewModel.markers,
                    mapType: MapType.normal,
                    gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
                      Factory<ScaleGestureRecognizer>(
                        () => ScaleGestureRecognizer(),
                      ),
                      Factory<PanGestureRecognizer>(
                        () => PanGestureRecognizer(),
                      ),
                      Factory<TapGestureRecognizer>(
                        () => TapGestureRecognizer(),
                      ),
                    },
                    zoomGesturesEnabled: true,
                    scrollGesturesEnabled: true,
                    myLocationButtonEnabled: false,
                    myLocationEnabled: false,
                  ),
                ),
              ),
            ],
          ),
        ),
      );
    },
  );
}
Reasons:
  • Whitelisted phrase (-2): Did you try
  • RegEx Blacklisted phrase (1.5): resolve it?
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: kikoso