Merge pull request #6 from MateusRosario/master

Adding Callback to send back values longitude and latitude when changed.
This commit is contained in:
Zebiao Hu 2020-08-10 02:35:01 +08:00 committed by GitHub
commit 7ac11651b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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) {