forked from josxha/flutter-maplibre
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: option to disable gestures (josxha#44)
- [x] update example app - [x] web implementation - [x] android implementation
- Loading branch information
Showing
21 changed files
with
934 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:maplibre/maplibre.dart'; | ||
|
||
@immutable | ||
class GesturesPage extends StatefulWidget { | ||
const GesturesPage({super.key}); | ||
|
||
static const location = '/gestures'; | ||
|
||
@override | ||
State<GesturesPage> createState() => _GesturesPageState(); | ||
} | ||
|
||
class _GesturesPageState extends State<GesturesPage> { | ||
final _selections = Map.fromEntries( | ||
Gestures.values.map((e) => MapEntry(e, false)), | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(title: const Text('Gestures')), | ||
body: Column( | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.all(8), | ||
child: Wrap( | ||
spacing: 8, | ||
runSpacing: 8, | ||
children: Gestures.values | ||
.map( | ||
(e) => ChoiceChip( | ||
label: Text(e.name), | ||
selected: _selections[e]!, | ||
onSelected: (value) => setState(() { | ||
_selections[e] = !_selections[e]!; | ||
}), | ||
), | ||
) | ||
.toList(growable: false), | ||
), | ||
), | ||
Expanded( | ||
child: MapLibreMap( | ||
options: MapOptions( | ||
center: Position(9.17, 47.68), | ||
zoom: 3, | ||
gestures: MapGestures( | ||
rotate: _selections[Gestures.rotate]!, | ||
pan: _selections[Gestures.pan]!, | ||
zoom: _selections[Gestures.zoom]!, | ||
pitch: _selections[Gestures.tilt]!, | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
enum Gestures { | ||
rotate, | ||
pan, | ||
zoom, | ||
tilt; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.