arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

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.

hashtag
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

Note that some gestures must be configured by other means, either instead of using flags, or in addition to.

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:

  • Add flags, with the bitwise 'OR' (|) operator in-between For example, InteractiveFlag.drag | InteractiveFlag.rotate

  • Remove flags from all, using the & and ~ operators in-between For example, InteractiveFlag.all & ~InteractiveFlag.rotate

hashtag
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:

hashtag
"Win" Gestures

circle-exclamation

This is advanced behaviour that affects how gestures 'win' in the gesture arena, and does not usually need changing.

InteractionOptions class - flutter_map library - Dart APIpub.devchevron-right
Logo
InteractiveFlag class - flutter_map library - Dart APIpub.devchevron-right
Logo
CursorKeyboardRotationOptions class - flutter_map library - Dart APIpub.devchevron-right
Logo