Adding Callback to send back values longitude and latitude when changed.

This commit is contained in:
MateusRosario 2020-08-08 19:15:16 -03:00
parent 9da4d8f268
commit 6a07780d9d

View file

@ -31,6 +31,7 @@ class Panorama extends StatefulWidget {
this.lonSegments = 64, this.lonSegments = 64,
this.interactive = true, this.interactive = true,
this.sensorControl = SensorControl.None, this.sensorControl = SensorControl.None,
this.onChangedCallback,
this.child, this.child,
}) : super(key: key); }) : super(key: key);
@ -82,6 +83,9 @@ class Panorama extends StatefulWidget {
/// Control the panorama with motion sensors. /// Control the panorama with motion sensors.
final SensorControl sensorControl; final SensorControl sensorControl;
/// It is called when the view direction has changed, sending the new longitude and latitude values back.
final Function(double, double) onChangedCallback;
/// Specify an Image(equirectangular image) widget to the panorama. /// Specify an Image(equirectangular image) widget to the panorama.
final Image child; final Image child;
@ -124,6 +128,8 @@ class _PanoramaState extends State<Panorama> with SingleTickerProviderStateMixin
} else } else
_controller.forward(); _controller.forward();
} }
widget.onChangedCallback(longitude, latitude);
} }
void _onSceneCreated(Scene scene) { void _onSceneCreated(Scene scene) {