FlutterEarthGlobeController class

This class is the controller of the RotatingGlobe widget.

It is used to add/remove/update points and connections. It is also used to control the rotation of the globe. It is also used to load the surface and background images. It is also used to set the style of the sphere. It is also used to listen to the events of the globe.

Inheritance

Constructors

FlutterEarthGlobeController({ImageProvider<Object>? surface, ImageProvider<Object>? nightSurface, ImageProvider<Object>? background, double rotationSpeed = 0.2, bool isZoomEnabled = true, double zoom = 1, double maxZoom = 2.5, double minZoom = -1.0, bool isRotating = false, bool isBackgroundFollowingSphereRotation = false, ImageConfiguration surfaceConfiguration = const ImageConfiguration(), ImageConfiguration nightSurfaceConfiguration = const ImageConfiguration(), ImageConfiguration backgroundConfiguration = const ImageConfiguration(), SphereStyle sphereStyle = const SphereStyle(), bool isDayNightCycleEnabled = false, DayNightMode dayNightMode = DayNightMode.textureSwap, Color simulatedNightColor = const ui.Color.fromARGB(255, 25, 38, 64), double simulatedNightIntensity = 0.15, double sunLongitude = 0.0, double sunLatitude = 0.0, double dayNightBlendFactor = 0.15, bool useRealTimeSunPosition = false, DayNightCycleDirection dayNightCycleDirection = DayNightCycleDirection.leftToRight, double zoomSensitivity = 0.8, double panSensitivity = 1.0, bool zoomToMousePosition = false, double panOffsetX = 0.0, double panOffsetY = 0.0, bool showAtmosphere = true, Color atmosphereColor = const ui.Color.fromARGB(255, 57, 123, 185), double atmosphereBlur = 30.0, double atmosphereThickness = 0.03, double atmosphereOpacity = 0.2, bool surfaceLightingEnabled = true, double lightAngle = -45.0, double lightIntensity = 0.75, double ambientLight = 0.6})

Properties

ambientLight double
Minimum brightness level (0.0 - 1.0), prevents total darkness on unlit side
getter/setter pair
atmosphereBlur double
Blur radius for the atmospheric glow
getter/setter pair
atmosphereColor Color
Color of the atmospheric glow
getter/setter pair
atmosphereOpacity double
Opacity of the atmospheric glow
getter/setter pair
atmosphereThickness double
Thickness of the atmosphere relative to globe radius
getter/setter pair
background Image?
getter/setter pair
backgroundConfiguration ImageConfiguration
getter/setter pair
connections List<AnimatedPointConnection>
getter/setter pair
dayNightBlendFactor double
getter/setter pair
dayNightCycleDirection DayNightCycleDirection
getter/setter pair
dayNightMode DayNightMode
The mode for rendering night side (textureSwap or simulated)
getter/setter pair
globeKey GlobalKey<RotatingGlobeState>
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isBackgroundFollowingSphereRotation bool
getter/setter pair
isDayNightCycleEnabled bool
getter/setter pair
isReady bool
Returns true if the globe is ready
no setter
isRotating bool
Returns true if the globe is rotating
getter/setter pair
isZoomEnabled bool
getter/setter pair
lightAngle double
Angle of the light source in degrees (-45 = top-left, 0 = right, 90 = bottom, etc.)
getter/setter pair
lightIntensity double
Intensity of the light/shadow effect (0.0 - 1.0)
getter/setter pair
maxZoom double
getter/setter pair
minZoom double
getter/setter pair
nightSurface Image?
getter/setter pair
nightSurfaceConfiguration ImageConfiguration
getter/setter pair
nightSurfaceProcessed Uint32List?
getter/setter pair
onLoaded VoidCallback?
A callback function that is called when the globe is loaded.
getter/setter pair
onPointConnectionAdded ↔ dynamic Function(AnimatedPointConnection connection, {required bool animateDraw, required Duration animateDrawDuration})?
getter/setter pair
onResetGlobeRotation ↔ dynamic Function()?
getter/setter pair
onStartDayNightCycleAnimation ↔ dynamic Function({Duration cycleDuration, DayNightCycleDirection direction})?
getter/setter pair
onStopDayNightCycleAnimation ↔ dynamic Function()?
getter/setter pair
panOffsetX double
getter/setter pair
panOffsetY double
getter/setter pair
panSensitivity double
getter/setter pair
points List<Point>
getter/setter pair
rotationController AnimationController
getter/setter pair
rotationSpeed double
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
satellites List<Satellite>
getter/setter pair
showAtmosphere bool
Whether to show the atmospheric glow around the globe
getter/setter pair
simulatedNightColor Color
Color tint for simulated night mode
getter/setter pair
simulatedNightIntensity double
Brightness/intensity of the night side in simulated mode (0.0 = very dark, 1.0 = full brightness)
getter/setter pair
sphereStyle SphereStyle
getter/setter pair
sunLatitude double
getter/setter pair
sunLongitude double
getter/setter pair
surface Image?
getter/setter pair
surfaceConfiguration ImageConfiguration
getter/setter pair
surfaceLightingEnabled bool
Whether to enable 3D surface lighting (creates realistic shading effect)
getter/setter pair
surfaceProcessed Uint32List?
getter/setter pair
useRealTimeSunPosition bool
getter/setter pair
zoom double
getter/setter pair
zoomSensitivity double
getter/setter pair
zoomToMousePosition bool
getter/setter pair

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addPoint(Point point) → void
Adds a point to the globe.
addPointConnection(PointConnection connection, {bool animateDraw = false, Duration animateDrawDuration = const Duration(seconds: 2)}) → void
Adds a connection between two points to the globe.
addSatellite(Satellite satellite) → void
Adds a satellite to the globe.
clearSatellites() → void
Removes all satellites from the globe.
dispose() → void
Disposes the controller.
override
focusOnCoordinates(GlobeCoordinates coordinates, {bool animate = false, Duration? duration = const Duration(milliseconds: 500)}) → void
Focuses on the coordinates on the globe.
getSatellite(String id) Satellite?
Gets a satellite by its id.
load() → void
loadBackground(ImageProvider<Object> image, {ImageConfiguration configuration = const ImageConfiguration(), bool isBackgroundFollowingSphereRotation = false}) → void
Loads the background image for the rotating globe.
loadNightSurface(ImageProvider<Object> image, {ImageConfiguration configuration = const ImageConfiguration()}) → void
Loads the image as the night surface of the globe for day/night cycle effect.
loadSurface(ImageProvider<Object> image, {ImageConfiguration configuration = const ImageConfiguration()}) → void
Loads the image as the surface of the globe.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeBackground() → void
Removes the background of the rotating globe.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removePoint(String id) → void
Removes the point from the globe.
removePointConnection(String id) → void
Removes the connection between two points from the globe.
removeSatellite(String id) → void
Removes the satellite from the globe.
resetPanOffset() → void
Resets the pan offset to center the globe in the view. This is useful after using zoom-to-cursor to return to the default centered position.
resetRotation() → void
Resets the rotation of the globe.
setDayNightBlendFactor(double factor) → void
Sets the blend factor for the day/night transition.
setDayNightCycleEnabled(bool enabled) → void
Enables or disables the day/night cycle effect.
setRotationSpeed(double rotationSpeed) → void
Sets the rotation speed of the globe.
setSimulatedNightStyle({Color? color, double? intensity}) → void
Sets the simulated night style with both color and intensity in a single call. This is more efficient than setting them separately when you need to change both.
setSphereStyle(SphereStyle style) → void
Sets the style of the rotating globe's sphere.
setSunPosition({double? longitude, double? latitude}) → void
Sets the sun's position for the day/night cycle effect.
setUseRealTimeSunPosition(bool enabled) → void
Enables or disables real-time sun position tracking.
setZoom(double zoom) → void
Sets the zoom level of the globe.
startDayNightCycle({Duration cycleDuration = const Duration(minutes: 1), DayNightCycleDirection? direction}) → void
Starts the day/night cycle animation.
startRotation({double? rotationSpeed}) → void
Starts the rotation of the globe.
stopDayNightCycle() → void
Stops the day/night cycle animation.
stopRotation() → void
Stops the rotation of the globe.
toggleRotation() → void
Toggles the rotation of the globe.
toString() String
A string representation of this object.
inherited
updatePoint(String id, {String? label, Widget? labelBuilder(BuildContext context, Point point, bool isHovering, bool isVisible)?, bool? isLabelVisible, Offset? labelOffset, PointStyle? style, TextStyle? labelTextStyle, VoidCallback? onTap, VoidCallback? onHover}) → void
Updates the point on the globe.
updatePointConnection(String id, {String? label, Widget? labelBuilder(BuildContext context, PointConnection pointConnection, bool isHovering, bool isVisible)?, bool? isLabelVisible, Offset? labelOffset, bool? isMoving, PointConnectionStyle? style, TextStyle? labelTextStyle, VoidCallback? onTap, VoidCallback? onHover}) → void
Updates the connection between two points on the globe.
updateSatellite(String id, {GlobeCoordinates? coordinates, double? altitude, String? label, Widget? labelBuilder(BuildContext context, Satellite satellite, bool isHovering, bool isVisible)?, bool? isLabelVisible, Offset? labelOffset, SatelliteStyle? style, TextStyle? labelTextStyle, SatelliteOrbit? orbit, VoidCallback? onTap, VoidCallback? onHover}) → void
Updates an existing satellite on the globe.
updateSunPositionFromRealTime() → void
Calculates and sets the sun's position based on real-time.

Operators

operator ==(Object other) bool
The equality operator.
inherited