4

I have working maps with GoogleMaps in my app but now I need to upload my app to AppGallery and I am trying to do my functionality with Huawei Maps.

However Huawei Maps not acting same as Google Maps and I don't know why.

This is my app, map should be hidden right now by Offstage class, I also tried it with Opacity, same effect and it's not showing properly in Stack class, what is wrong with these maps?

enter image description here

Here is my code for that:

return Builder(
              builder: (context) {
                bContext = context;
                widget.firstLoad = false;
                googleMapKey = GlobalKey<GoogleMapDrawerState>(
                    debugLabel: 'googleMapWidget');
                Provider.of<ControllerProvider>(context, listen: false)
                    .loadGoogleMapKey(googleMapKey);
                var googleMap = GoogleMapDrawer(
                    key: googleMapKey,
                    mapCompleted: (controller) {
                      Provider.of<ControllerProvider>(context, listen: false)
                          .loadController(controller);
                      if (Theme.of(context).brightness == Brightness.dark) {
                        Provider.of<ControllerProvider>(context, listen: false)
                            .changeTheme(Brightness.dark);
                      }
                    },
                    markers:
                        Provider.of<ControllerProvider>(context, listen: false)
                                    .marker !=
                                null
                            ? [
                                Provider.of<ControllerProvider>(context,
                                        listen: false)
                                    .marker
                              ]
                            : [],
                    cameraPosition: hm.CameraPosition(
                        target: hm.LatLng(53.00825 + 0.004, 18.59762), zoom: 15));
                return Scaffold(
                  body: Stack(children: [
                    Offstage(
                      offstage: true,
                      child: googleMap,
                    ),

and here is my class GoogleMapDrawer:

return SizedBox(
      height: size.height * 0.51,
      width: size.width,
      child: /*GoogleMap(
          initialCameraPosition: widget.cameraPosition!,
          markers: markers != null ? Set.from(markers) : <Marker>{},
          onMapCreated: (controller) {
            Provider.of<ControllerProvider>(context, listen: false)
                .currentMapBrightness = Theme.of(context).brightness;
            widget.mapCompleted(controller);
          })*/
          HuaweiMap(
              initialCameraPosition: widget.cameraPosition!,
              markers: markers != null ? Set.from(markers) : <Marker>{},
              onMapCreated: (controller) {
                Provider.of<ControllerProvider>(context, listen: false)
                    .currentMapBrightness = Theme.of(context).brightness;
                widget.mapCompleted(controller);
              },
          )
    );

I left commented code to show that it's the same code for HuaweiMaps as for GoogleMaps. With Google Maps it was working fine, now its not. Also in another view maps should be under other widget but with HuaweiMaps its above other widget. Why is working like this and how to fix it?

1 Answers1

0

https://github.com/HMS-Core/hms-flutter-plugin/issues/191

I found this issue, so it's probably problem with Huawei Map package