zyzdev / flutter_street_view

10 stars 32 forks source link

Previous street view retained #26

Open jeromeDms opened 1 year ago

jeromeDms commented 1 year ago

Hi, Thanks for this nice plugin. I noticed when opening multiple street view using your plugin, the previous view is first displayed before jumping to new Lat/Lng. I'm using your view with navigator.push When clicking the top left back button, the widget is properly disposed, then the next call to your class shows the previous street view before jumping to the new Lat/Lng. I'm using your plugin as follow :

@override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(S.current.decouvrirQuartier, style: TextStyle(fontSize: APP_BAR_FONT_SIZE, fontWeight: APP_BAR_FONT_WEIGHT),),
          leading: IconButton(
            icon: const Icon(Icons.arrow_back),
            onPressed: () => Navigator.pop(context),
          ),
        ),
        body: SafeArea(
          child: 
              FlutterGoogleStreetView(
                **initPos: LatLng(widget.thePoi.latitude, widget.thePoi.longitude),**
                markers: markers,
                //motionTracking: true,
                streetNamesEnabled: true,
                userNavigationEnabled: true,
                onStreetViewCreated: (controller) {
                  setState(() {
                    _controller = controller;
                  });
                },
                onPanoramaChangeListener: (location, e) {
                  if(e != null) {
                    Utils.showMyDialogAlert(
                        context,
                        "assets/images/logoH256.png",
                        S.current.Erreur,
                        S.current.StreetViewNotAvailable,
                        null,
                        "OK", () {
                      Navigator.pop(context);
                    });
                  }
                },
              ),
        ),
    );
  }

Any idea why the previous view is retained ? Thanks

https://github.com/zyzdev/flutter_street_view/assets/19860492/70be415a-1089-4ff8-8e5a-402ef22dcdad

jannisnikoy commented 1 year ago

Any insights on this?