-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathscrolling_map.dart
114 lines (106 loc) · 3.81 KB
/
scrolling_map.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:apple_maps_flutter/apple_maps_flutter.dart';
// ignore_for_file: public_member_api_docs
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'page.dart';
class ScrollingMapPage extends ExamplePage {
ScrollingMapPage() : super(const Icon(Icons.map), 'Scrolling map');
@override
Widget build(BuildContext context) {
return const ScrollingMapBody();
}
}
class ScrollingMapBody extends StatelessWidget {
const ScrollingMapBody();
final LatLng center = const LatLng(32.080664, 34.9563837);
@override
Widget build(BuildContext context) {
return SafeArea(
bottom: false,
child: ListView(
children: <Widget>[
Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: <Widget>[
const Padding(
padding: EdgeInsets.only(bottom: 12.0),
child: Text('This map consumes all touch events.'),
),
SizedBox(
height: 300.0,
child: AppleMap(
initialCameraPosition: CameraPosition(
target: center,
zoom: 11.0,
),
gestureRecognizers:
<Factory<OneSequenceGestureRecognizer>>[
Factory<OneSequenceGestureRecognizer>(
() => EagerGestureRecognizer(),
),
].toSet(),
),
),
],
),
),
),
Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: <Widget>[
const Text('This map doesn\'t consume the vertical drags.'),
const Padding(
padding: EdgeInsets.only(bottom: 12.0),
child: Text(
'It still gets other gestures (e.g scale or tap).'),
),
Center(
child: SizedBox(
height: 300.0,
child: AppleMap(
initialCameraPosition: CameraPosition(
target: center,
zoom: 11.0,
),
annotations: Set<Annotation>.of(
<Annotation>[
Annotation(
annotationId: AnnotationId("test_Annotation_id"),
position: LatLng(
center.latitude,
center.longitude,
),
infoWindow: const InfoWindow(
title: 'An interesting location',
snippet: '*',
),
)
],
),
gestureRecognizers:
<Factory<OneSequenceGestureRecognizer>>[
Factory<OneSequenceGestureRecognizer>(
() => ScaleGestureRecognizer(),
),
].toSet(),
insetsLayoutMarginsFromSafeArea: false,
),
),
),
],
),
),
),
],
),
);
}
}