flet-map 0.1.0.dev2__py3-none-any.whl → 0.2.0.dev45__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of flet-map might be problematic. Click here for more details.
- flet_map/__init__.py +30 -19
- flet_map/circle_layer.py +46 -139
- flet_map/map.py +462 -604
- flet_map/map_layer.py +14 -20
- flet_map/marker_layer.py +83 -169
- flet_map/polygon_layer.py +95 -232
- flet_map/polyline_layer.py +85 -262
- flet_map/rich_attribution.py +48 -126
- flet_map/simple_attribution.py +24 -75
- flet_map/source_attribution.py +73 -0
- flet_map/tile_layer.py +224 -266
- flet_map/types.py +953 -0
- flet_map-0.2.0.dev45.dist-info/METADATA +66 -0
- flet_map-0.2.0.dev45.dist-info/RECORD +35 -0
- {flet_map-0.1.0.dev2.dist-info → flet_map-0.2.0.dev45.dist-info}/WHEEL +1 -1
- flet_map-0.2.0.dev45.dist-info/licenses/LICENSE +201 -0
- flutter/flet_map/CHANGELOG.md +4 -0
- flutter/flet_map/lib/flet_map.dart +1 -1
- flutter/flet_map/lib/src/circle_layer.dart +15 -25
- flutter/flet_map/lib/src/extension.dart +37 -0
- flutter/flet_map/lib/src/map.dart +93 -105
- flutter/flet_map/lib/src/marker_layer.dart +21 -33
- flutter/flet_map/lib/src/polygon_layer.dart +32 -52
- flutter/flet_map/lib/src/polyline_layer.dart +41 -64
- flutter/flet_map/lib/src/rich_attribution.dart +34 -34
- flutter/flet_map/lib/src/simple_attribution.dart +9 -23
- flutter/flet_map/lib/src/tile_layer.dart +47 -60
- flutter/flet_map/lib/src/utils/attribution_alignment.dart +1 -3
- flutter/flet_map/lib/src/utils/map.dart +257 -203
- flutter/flet_map/pubspec.lock +179 -130
- flutter/flet_map/pubspec.yaml +10 -5
- flet_map/text_source_attribution.py +0 -87
- flet_map-0.1.0.dev2.dist-info/METADATA +0 -168
- flet_map-0.1.0.dev2.dist-info/RECORD +0 -34
- flutter/flet_map/lib/src/create_control.dart +0 -70
- flutter/flet_map/lib/src/text_source_attribution.dart +0 -29
- {flet_map-0.1.0.dev2.dist-info → flet_map-0.2.0.dev45.dist-info}/top_level.txt +0 -0
|
@@ -6,45 +6,33 @@ import 'package:flutter_map_animations/flutter_map_animations.dart';
|
|
|
6
6
|
import 'utils/map.dart';
|
|
7
7
|
|
|
8
8
|
class MarkerLayerControl extends StatelessWidget with FletStoreMixin {
|
|
9
|
-
final Control? parent;
|
|
10
9
|
final Control control;
|
|
11
|
-
final List<Control> children;
|
|
12
|
-
final bool parentDisabled;
|
|
13
10
|
|
|
14
|
-
const MarkerLayerControl(
|
|
15
|
-
{super.key,
|
|
16
|
-
required this.parent,
|
|
17
|
-
required this.control,
|
|
18
|
-
required this.children,
|
|
19
|
-
required this.parentDisabled});
|
|
11
|
+
const MarkerLayerControl({super.key, required this.control});
|
|
20
12
|
|
|
21
13
|
@override
|
|
22
14
|
Widget build(BuildContext context) {
|
|
23
15
|
debugPrint("MarkerLayerControl build: ${control.id}");
|
|
16
|
+
var markers = control
|
|
17
|
+
.children("markers")
|
|
18
|
+
.where((c) => c.type == "Marker")
|
|
19
|
+
.map((marker) {
|
|
20
|
+
return AnimatedMarker(
|
|
21
|
+
point: parseLatLng(marker.get("coordinates"))!,
|
|
22
|
+
rotate: marker.getBool("rotate"),
|
|
23
|
+
height: marker.getDouble("height", 30.0)!,
|
|
24
|
+
width: marker.getDouble("width", 30.0)!,
|
|
25
|
+
alignment: marker.getAlignment("alignment"),
|
|
26
|
+
builder: (BuildContext context, Animation<double> animation) {
|
|
27
|
+
return marker.buildWidget("content") ??
|
|
28
|
+
const ErrorControl("content must be provided and visible");
|
|
29
|
+
});
|
|
30
|
+
}).toList();
|
|
24
31
|
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.map((marker) {
|
|
31
|
-
return AnimatedMarker(
|
|
32
|
-
point: parseLatLng(marker.control, "coordinates")!,
|
|
33
|
-
rotate: marker.control.attrBool("rotate"),
|
|
34
|
-
height: marker.control.attrDouble("height", 30)!,
|
|
35
|
-
width: marker.control.attrDouble("width", 30)!,
|
|
36
|
-
alignment: parseAlignment(marker.control, "alignment"),
|
|
37
|
-
builder: (BuildContext context, Animation<double> animation) {
|
|
38
|
-
return createControl(
|
|
39
|
-
control, marker.control.childIds.first, parentDisabled);
|
|
40
|
-
});
|
|
41
|
-
}).toList();
|
|
42
|
-
|
|
43
|
-
return AnimatedMarkerLayer(
|
|
44
|
-
markers: markers,
|
|
45
|
-
rotate: control.attrBool("rotate", false)!,
|
|
46
|
-
alignment: parseAlignment(control, "alignment", Alignment.center)!,
|
|
47
|
-
);
|
|
48
|
-
});
|
|
32
|
+
return AnimatedMarkerLayer(
|
|
33
|
+
markers: markers,
|
|
34
|
+
rotate: control.getBool("rotate", false)!,
|
|
35
|
+
alignment: control.getAlignment("alignment", Alignment.center)!,
|
|
36
|
+
);
|
|
49
37
|
}
|
|
50
38
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import 'dart:convert';
|
|
2
|
-
|
|
3
|
-
import 'package:collection/collection.dart';
|
|
4
1
|
import 'package:flet/flet.dart';
|
|
5
2
|
import 'package:flutter/material.dart';
|
|
6
3
|
import 'package:flutter_map/flutter_map.dart';
|
|
@@ -8,61 +5,44 @@ import 'package:flutter_map/flutter_map.dart';
|
|
|
8
5
|
import 'utils/map.dart';
|
|
9
6
|
|
|
10
7
|
class PolygonLayerControl extends StatelessWidget with FletStoreMixin {
|
|
11
|
-
final Control? parent;
|
|
12
8
|
final Control control;
|
|
13
9
|
|
|
14
|
-
const PolygonLayerControl(
|
|
15
|
-
{super.key, required this.parent, required this.control});
|
|
10
|
+
const PolygonLayerControl({super.key, required this.control});
|
|
16
11
|
|
|
17
12
|
@override
|
|
18
13
|
Widget build(BuildContext context) {
|
|
19
14
|
debugPrint("PolygonLayerControl build: ${control.id}");
|
|
20
15
|
|
|
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
|
-
.whereNotNull()
|
|
53
|
-
.toList()
|
|
54
|
-
: []);
|
|
55
|
-
}).toList();
|
|
56
|
-
|
|
57
|
-
return PolygonLayer(
|
|
58
|
-
polygons: polygons,
|
|
59
|
-
polygonCulling: control.attrBool("polygonCulling", false)!,
|
|
60
|
-
polygonLabels: control.attrBool("polygonLabels", true)!,
|
|
61
|
-
drawLabelsLast: control.attrBool("drawLabelsLast", false)!,
|
|
62
|
-
simplificationTolerance:
|
|
63
|
-
control.attrDouble("simplificationTolerance", 0.5)!,
|
|
64
|
-
useAltRendering: control.attrBool("useAlternativeRendering", false)!,
|
|
65
|
-
);
|
|
66
|
-
});
|
|
16
|
+
var polygons = control
|
|
17
|
+
.children("polygons")
|
|
18
|
+
.where((c) => c.type == "PolygonMarker")
|
|
19
|
+
.map((polygon) {
|
|
20
|
+
return Polygon(
|
|
21
|
+
borderStrokeWidth: polygon.getDouble("border_stroke_width", 0)!,
|
|
22
|
+
borderColor: polygon.getColor("border_color", context, Colors.green)!,
|
|
23
|
+
color: polygon.getColor("color", context, Colors.green)!,
|
|
24
|
+
disableHolesBorder: polygon.getBool("disable_holes_border", false)!,
|
|
25
|
+
rotateLabel: polygon.getBool("rotate_label", false)!,
|
|
26
|
+
label: polygon.getString("label"),
|
|
27
|
+
labelStyle: polygon.getTextStyle(
|
|
28
|
+
"label_text_style", Theme.of(context), const TextStyle())!,
|
|
29
|
+
strokeCap: polygon.getStrokeCap("stroke_cap", StrokeCap.round)!,
|
|
30
|
+
strokeJoin: polygon.getStrokeJoin("stroke_join", StrokeJoin.round)!,
|
|
31
|
+
points: polygon
|
|
32
|
+
.get("coordinates", [])!
|
|
33
|
+
.map((c) => parseLatLng(c))
|
|
34
|
+
.nonNulls
|
|
35
|
+
.toList());
|
|
36
|
+
}).toList();
|
|
37
|
+
|
|
38
|
+
return PolygonLayer(
|
|
39
|
+
polygons: polygons,
|
|
40
|
+
polygonCulling: control.getBool("polygon_culling", true)!,
|
|
41
|
+
polygonLabels: control.getBool("polygon_labels", true)!,
|
|
42
|
+
drawLabelsLast: control.getBool("draw_labels_last", false)!,
|
|
43
|
+
simplificationTolerance:
|
|
44
|
+
control.getDouble("simplification_tolerance", 0.3)!,
|
|
45
|
+
useAltRendering: control.getBool("use_alternative_rendering", false)!,
|
|
46
|
+
);
|
|
67
47
|
}
|
|
68
48
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import 'dart:convert';
|
|
2
|
-
|
|
3
|
-
import 'package:collection/collection.dart';
|
|
4
1
|
import 'package:flet/flet.dart';
|
|
5
2
|
import 'package:flutter/material.dart';
|
|
6
3
|
import 'package:flutter_map/flutter_map.dart';
|
|
@@ -8,73 +5,53 @@ import 'package:flutter_map/flutter_map.dart';
|
|
|
8
5
|
import 'utils/map.dart';
|
|
9
6
|
|
|
10
7
|
class PolylineLayerControl extends StatelessWidget with FletStoreMixin {
|
|
11
|
-
final Control? parent;
|
|
12
8
|
final Control control;
|
|
13
|
-
final List<Control> children;
|
|
14
9
|
|
|
15
|
-
const PolylineLayerControl(
|
|
16
|
-
{super.key,
|
|
17
|
-
required this.parent,
|
|
18
|
-
required this.control,
|
|
19
|
-
required this.children});
|
|
10
|
+
const PolylineLayerControl({super.key, required this.control});
|
|
20
11
|
|
|
21
12
|
@override
|
|
22
13
|
Widget build(BuildContext context) {
|
|
23
14
|
debugPrint("PolylineLayerControl build: ${control.id}");
|
|
24
15
|
|
|
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
|
-
.map((e) => latLngFromJson(e))
|
|
66
|
-
.whereNotNull()
|
|
67
|
-
.toList()
|
|
68
|
-
: []);
|
|
69
|
-
}).toList();
|
|
70
|
-
|
|
71
|
-
return PolylineLayer(
|
|
72
|
-
polylines: polylines,
|
|
73
|
-
cullingMargin: control.attrDouble("cullingMargin", 10)!,
|
|
74
|
-
minimumHitbox: control.attrDouble("minHittableRadius", 10)!,
|
|
75
|
-
simplificationTolerance:
|
|
76
|
-
control.attrDouble("simplificationTolerance", 0.4)!,
|
|
77
|
-
);
|
|
78
|
-
});
|
|
16
|
+
var polylines = control
|
|
17
|
+
.children("polygons")
|
|
18
|
+
.where((c) => c.type == "PolygonMarker")
|
|
19
|
+
.map((polyline) {
|
|
20
|
+
return Polyline(
|
|
21
|
+
borderStrokeWidth: polyline.getDouble("border_stroke_width", 0)!,
|
|
22
|
+
borderColor:
|
|
23
|
+
polyline.getColor("border_color", context, Colors.yellow)!,
|
|
24
|
+
color: polyline.getColor("color", context, Colors.yellow)!,
|
|
25
|
+
pattern: parseStrokePattern(
|
|
26
|
+
polyline.get("stroke_pattern"), const StrokePattern.solid())!,
|
|
27
|
+
strokeCap: polyline.getStrokeCap("stroke_cap", StrokeCap.round)!,
|
|
28
|
+
strokeJoin: polyline.getStrokeJoin("stroke_join", StrokeJoin.round)!,
|
|
29
|
+
strokeWidth: polyline.getDouble("stroke_width", 1.0)!,
|
|
30
|
+
useStrokeWidthInMeter:
|
|
31
|
+
polyline.getBool("use_stroke_width_in_meter", false)!,
|
|
32
|
+
colorsStop: polyline
|
|
33
|
+
.get("colors_stop", [])!
|
|
34
|
+
.map((e) => parseDouble(e))
|
|
35
|
+
.nonNulls
|
|
36
|
+
.toList(),
|
|
37
|
+
gradientColors: polyline
|
|
38
|
+
.get("gradient_colors", [])!
|
|
39
|
+
.map((e) => parseColor(e, Theme.of(context)))
|
|
40
|
+
.nonNulls
|
|
41
|
+
.toList(),
|
|
42
|
+
points: polyline
|
|
43
|
+
.get("coordinates", [])!
|
|
44
|
+
.map((c) => parseLatLng(c))
|
|
45
|
+
.nonNulls
|
|
46
|
+
.toList());
|
|
47
|
+
}).toList();
|
|
48
|
+
|
|
49
|
+
return PolylineLayer(
|
|
50
|
+
polylines: polylines,
|
|
51
|
+
cullingMargin: control.getDouble("culling_margin", 10.0)!,
|
|
52
|
+
minimumHitbox: control.getDouble("min_hittable_radius", 10.0)!,
|
|
53
|
+
simplificationTolerance:
|
|
54
|
+
control.getDouble("simplification_tolerance", 0.3)!,
|
|
55
|
+
);
|
|
79
56
|
}
|
|
80
57
|
}
|
|
@@ -5,15 +5,9 @@ import 'package:flutter_map/flutter_map.dart';
|
|
|
5
5
|
import 'utils/attribution_alignment.dart';
|
|
6
6
|
|
|
7
7
|
class RichAttributionControl extends StatefulWidget {
|
|
8
|
-
final Control? parent;
|
|
9
8
|
final Control control;
|
|
10
|
-
final FletControlBackend backend;
|
|
11
9
|
|
|
12
|
-
const RichAttributionControl(
|
|
13
|
-
{super.key,
|
|
14
|
-
this.parent,
|
|
15
|
-
required this.control,
|
|
16
|
-
required this.backend});
|
|
10
|
+
const RichAttributionControl({super.key, required this.control});
|
|
17
11
|
|
|
18
12
|
@override
|
|
19
13
|
State<RichAttributionControl> createState() => _RichAttributionControlState();
|
|
@@ -25,37 +19,43 @@ class _RichAttributionControlState extends State<RichAttributionControl>
|
|
|
25
19
|
Widget build(BuildContext context) {
|
|
26
20
|
debugPrint("RichAttributionControl build: ${widget.control.id}");
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
22
|
+
var attributions = widget.control
|
|
23
|
+
.children("attributions")
|
|
24
|
+
.map((Control c) {
|
|
25
|
+
if (c.type == "TextSourceAttribution") {
|
|
26
|
+
return TextSourceAttribution(
|
|
27
|
+
c.getString("text", "Placeholder Text")!,
|
|
28
|
+
textStyle: c.getTextStyle("text_style", Theme.of(context)),
|
|
29
|
+
onTap: () => c.triggerEvent("click"),
|
|
30
|
+
prependCopyright: c.getBool("prepend_copyright", true)!,
|
|
31
|
+
);
|
|
32
|
+
} else if (c.type == "ImageSourceAttribution") {
|
|
33
|
+
var image = c.buildWidget("image");
|
|
34
|
+
if (image == null) return null;
|
|
35
|
+
return LogoSourceAttribution(
|
|
36
|
+
image,
|
|
37
|
+
height: c.getDouble("height", 24.0)!,
|
|
38
|
+
tooltip: c.getString("tooltip"),
|
|
39
|
+
onTap: () => c.triggerEvent("click"),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
.nonNulls
|
|
44
|
+
.toList();
|
|
45
|
+
|
|
46
|
+
return RichAttributionWidget(
|
|
46
47
|
attributions: attributions,
|
|
47
|
-
permanentHeight: widget.control.
|
|
48
|
-
popupBackgroundColor: widget.control.
|
|
48
|
+
permanentHeight: widget.control.getDouble("permanent_height", 24.0)!,
|
|
49
|
+
popupBackgroundColor: widget.control.getColor(
|
|
50
|
+
"popup_bgcolor", context, Theme.of(context).colorScheme.surface),
|
|
49
51
|
showFlutterMapAttribution:
|
|
50
|
-
widget.control.
|
|
52
|
+
widget.control.getBool("show_flutter_map_attribution", true)!,
|
|
51
53
|
alignment: parseAttributionAlignment(
|
|
52
|
-
widget.control.
|
|
54
|
+
widget.control.getString("alignment"),
|
|
53
55
|
AttributionAlignment.bottomRight)!,
|
|
54
56
|
popupBorderRadius:
|
|
55
|
-
|
|
56
|
-
popupInitialDisplayDuration:
|
|
57
|
-
|
|
58
|
-
);
|
|
59
|
-
});
|
|
57
|
+
widget.control.getBorderRadius("popup_border_radius"),
|
|
58
|
+
popupInitialDisplayDuration: widget.control
|
|
59
|
+
.getDuration("popup_initial_display_duration", Duration.zero)!);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
import 'package:flet/flet.dart';
|
|
2
2
|
import 'package:flutter/material.dart';
|
|
3
|
-
import 'package:flutter/widgets.dart';
|
|
4
3
|
import 'package:flutter_map/flutter_map.dart';
|
|
5
4
|
|
|
6
|
-
class SimpleAttributionControl extends
|
|
7
|
-
final Control? parent;
|
|
5
|
+
class SimpleAttributionControl extends StatelessWidget {
|
|
8
6
|
final Control control;
|
|
9
|
-
final FletControlBackend backend;
|
|
10
7
|
|
|
11
|
-
const SimpleAttributionControl(
|
|
12
|
-
{super.key,
|
|
13
|
-
this.parent,
|
|
14
|
-
required this.control,
|
|
15
|
-
required this.backend});
|
|
8
|
+
const SimpleAttributionControl({super.key, required this.control});
|
|
16
9
|
|
|
17
|
-
@override
|
|
18
|
-
State<SimpleAttributionControl> createState() =>
|
|
19
|
-
_SimpleAttributionControlState();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
class _SimpleAttributionControlState extends State<SimpleAttributionControl> {
|
|
23
10
|
@override
|
|
24
11
|
Widget build(BuildContext context) {
|
|
25
|
-
debugPrint("SimpleAttributionControl build: ${
|
|
12
|
+
debugPrint("SimpleAttributionControl build: ${control.id}");
|
|
13
|
+
var text = control.buildTextOrWidget("text");
|
|
26
14
|
|
|
27
15
|
return SimpleAttributionWidget(
|
|
28
|
-
source: Text
|
|
29
|
-
onTap: ()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
alignment:
|
|
34
|
-
parseAlignment(widget.control, "alignment", Alignment.bottomRight)!,
|
|
16
|
+
source: text is Text ? text : const Text("Placeholder Text"),
|
|
17
|
+
onTap: () => control.triggerEvent("click"),
|
|
18
|
+
backgroundColor: control.getColor(
|
|
19
|
+
"bgcolor", context, Theme.of(context).colorScheme.surface)!,
|
|
20
|
+
alignment: control.getAlignment("alignment", Alignment.bottomRight)!,
|
|
35
21
|
);
|
|
36
22
|
}
|
|
37
23
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import 'dart:convert';
|
|
2
|
-
|
|
3
1
|
import 'package:flet/flet.dart';
|
|
4
2
|
import 'package:flutter/material.dart';
|
|
5
3
|
import 'package:flutter/widgets.dart';
|
|
@@ -8,73 +6,62 @@ import 'package:flutter_map_cancellable_tile_provider/flutter_map_cancellable_ti
|
|
|
8
6
|
|
|
9
7
|
import './utils/map.dart';
|
|
10
8
|
|
|
11
|
-
class TileLayerControl extends StatelessWidget
|
|
12
|
-
final Control? parent;
|
|
9
|
+
class TileLayerControl extends StatelessWidget {
|
|
13
10
|
final Control control;
|
|
14
|
-
final FletControlBackend backend;
|
|
15
11
|
|
|
16
|
-
const TileLayerControl(
|
|
17
|
-
{super.key,
|
|
18
|
-
required this.parent,
|
|
19
|
-
required this.control,
|
|
20
|
-
required this.backend});
|
|
12
|
+
const TileLayerControl({super.key, required this.control});
|
|
21
13
|
|
|
22
14
|
@override
|
|
23
15
|
Widget build(BuildContext context) {
|
|
24
16
|
debugPrint("TileLayerControl build: ${control.id}");
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
ImageProvider<Object>? errorImage;
|
|
30
|
-
|
|
31
|
-
if (errorImageSrc != null) {
|
|
32
|
-
var assetSrc =
|
|
33
|
-
getAssetSrc((errorImageSrc), pageArgs.pageUri!, pageArgs.assetsDir);
|
|
18
|
+
var errorImageSrc = control.getString("errorImageSrc");
|
|
19
|
+
ImageProvider<Object>? errorImage;
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
if (errorImageSrc != null) {
|
|
22
|
+
var assetSrc = control.backend.getAssetSource(errorImageSrc);
|
|
23
|
+
if (assetSrc.isFile) {
|
|
24
|
+
// from File
|
|
25
|
+
errorImage = AssetImage(assetSrc.path);
|
|
26
|
+
} else {
|
|
27
|
+
// URL
|
|
28
|
+
errorImage = NetworkImage(assetSrc.path);
|
|
42
29
|
}
|
|
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
|
-
|
|
30
|
+
}
|
|
31
|
+
Widget tileLayer = TileLayer(
|
|
32
|
+
urlTemplate: control.getString("url_template"),
|
|
33
|
+
fallbackUrl: control.getString("fallback_url"),
|
|
34
|
+
subdomains: control
|
|
35
|
+
.get<List>("subdomains")
|
|
36
|
+
?.map((e) => e.toString())
|
|
37
|
+
.toList() ??
|
|
38
|
+
['a', 'b', 'c'],
|
|
39
|
+
tileProvider: CancellableNetworkTileProvider(),
|
|
40
|
+
tileDisplay: parseTileDisplay(
|
|
41
|
+
control.get("display_mode"), const TileDisplay.fadeIn())!,
|
|
42
|
+
tileDimension: control.getInt("tile_size", 256)!,
|
|
43
|
+
userAgentPackageName:
|
|
44
|
+
control.getString("user_agent_package_name", 'unknown')!,
|
|
45
|
+
minNativeZoom: control.getInt("min_native_zoom", 0)!,
|
|
46
|
+
maxNativeZoom: control.getInt("max_native_zoom", 19)!,
|
|
47
|
+
zoomReverse: control.getBool("zoom_reverse", false)!,
|
|
48
|
+
zoomOffset: control.getDouble("zoom_offset", 0)!,
|
|
49
|
+
keepBuffer: control.getInt("keep_buffer", 2)!,
|
|
50
|
+
panBuffer: control.getInt("pan_buffer", 1)!,
|
|
51
|
+
tms: control.getBool("enable_tms", false)!,
|
|
52
|
+
tileBounds: parseLatLngBounds(control.get("tile_bounds")),
|
|
53
|
+
retinaMode: control.getBool("enable_retina_mode"),
|
|
54
|
+
maxZoom: control.getDouble("max_zoom", double.infinity)!,
|
|
55
|
+
minZoom: control.getDouble("min_zoom", 0)!,
|
|
56
|
+
evictErrorTileStrategy: parseEvictErrorTileStrategy(
|
|
57
|
+
control.getString("evict_error_tile_strategy"),
|
|
58
|
+
EvictErrorTileStrategy.none)!,
|
|
59
|
+
errorImage: errorImage,
|
|
60
|
+
errorTileCallback: (TileImage t, Object o, StackTrace? s) {
|
|
61
|
+
control.triggerEvent("image_error", o.toString());
|
|
62
|
+
},
|
|
63
|
+
additionalOptions: control.get("additional_options", {})!);
|
|
76
64
|
|
|
77
|
-
|
|
78
|
-
});
|
|
65
|
+
return ConstrainedControl(control: control, child: tileLayer);
|
|
79
66
|
}
|
|
80
67
|
}
|
|
@@ -3,9 +3,7 @@ import 'package:flutter_map/flutter_map.dart';
|
|
|
3
3
|
|
|
4
4
|
AttributionAlignment? parseAttributionAlignment(String? value,
|
|
5
5
|
[AttributionAlignment? defValue]) {
|
|
6
|
-
if (value == null)
|
|
7
|
-
return defValue;
|
|
8
|
-
}
|
|
6
|
+
if (value == null) return defValue;
|
|
9
7
|
return AttributionAlignment.values.firstWhereOrNull(
|
|
10
8
|
(e) => e.name.toLowerCase() == value.toLowerCase()) ??
|
|
11
9
|
defValue;
|