Compass class

A Compass (also known as a "north arrow") is a widget that visualizes the current rotation of an ArcGISMapView or ArcGISSceneView.

Overview

Features

  • Automatically hides when the rotation is zero / oriented North.
  • Can be configured to be always visible.
  • Will reset the map/scene rotation to North when tapped on.

Usage

A Compass is generally placed in a Stack on top of an ArcGISMapView or ArcGISSceneView. The compass must be provided the same ArcGISMapViewController or ArcGISSceneViewController as the corresponding map view or scene view.

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          ArcGISMapView(
            controllerProvider: controllerProvider,
           ),
          Compass(
            controllerProvider: controllerProvider,
           ),
         ],
       ),
     );
   }
Inheritance

Constructors

Compass.new({required GeoViewController controllerProvider(), Key? key, bool automaticallyHides = true, Alignment alignment = Alignment.topRight, EdgeInsets padding = const EdgeInsets.all(10), double size = 50, Widget iconBuilder(BuildContext context, double size, double angleRadians)?})
Create a Compass widget.
const

Properties

alignment Alignment
The alignment of the compass within the parent widget. Defaults to Alignment.topRight. The compass should generally be placed in a Stack on top of the corresponding ArcGISMapView or ArcGISSceneView.
final
automaticallyHides bool
Whether the compass should automatically hide when the map is oriented north. Defaults to true. If set to false, the compass will always be visible.
final
controllerProvider → GeoViewController Function()
A function that provides a GeoViewController to listen to and control. This should return the same controller that is provided to the corresponding ArcGISMapView or ArcGISSceneView.
final
hashCode int
The hash code for this object.
no setterinherited
iconBuilder Widget Function(BuildContext context, double size, double angleRadians)?
A function to build the compass icon. If not provided, a default compass icon will be used. Provide a function to customize the icon. The returned icon must be a Widget with width and height of size and some element rotated to angleRadians to indicate north.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
padding EdgeInsets
The padding around the compass. Defaults to 10 pixels on all sides.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
The width and height of the compass icon in pixels. Defaults to 50 pixels.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<Compass>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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