githubEdit

Interaction Options

The InteractionOptions object passed to MapOptions.interactiveOptions configures the gestures that the user can use to interact with the map. For example, disable rotation or configure cursor/keyboard rotation.

Flags

flags is a bitfieldarrow-up-right that enables and disables the vast majority of gestures. Although technically the type is of int, it is usually set with a combination of InteractiveFlags.

circle-exclamation

By default, all gestures are enabled, but a non-interactive map can be created using none (and other options in addition).

circle-info

The recommended way to create an entirely non-interactive map is to wrap the FlutterMap widget in an IgnorePointer widget.

Otherwise, to set flags, there's two methods:

  • Allow ONLY specified interactions, with the bitwise 'OR' (|) operator For example, InteractiveFlag.drag | InteractiveFlag.rotate, allows the map to ONLY be dragged or rotated (by the touchscreen), except any other options configured separately (such as keyboard options)

  • Disable specified interactions, using the & and ~ operators For example, ~InteractiveFlag.rotate (which is equivalent to InteractiveFlag.all & ~InteractiveFlag.rotate)

For example, to disable flinging:

Cursor/Keyboard Rotation

Cursor/keyboard rotation is designed for desktop platforms, and allows the cursor to be used to set the rotation of the map whilst a (customizable) keyboard key (by default, any of the 'Control' keys) is held down.

The CursorKeyboardRotationOptions object passed to the property with the corresponding name configures this behaviour. The CursorKeyboardRotationOptions.disabled() constructor can be used to disable cursor/keyboard rotation.

There's many customization options, see the API docs for more information:

Keyboard Gestures

Keyboard gestures can be configured through KeyboardOptions. By default, the map can be panned via the arrow keys. Additionally, panning using the WASD keys can be enabled, as well as rotation with Q & E, and zooming with R & F. All keys are physical and based on the QWERTY keyboard, so on other keyboards, the positions will be the same, not necessary the characters.

Leaping occurs when the trigger key is pressed momentarily instead of being held down. This can also be customized.

"Win" Gestures

circle-exclamation

Last updated

Was this helpful?