RenderEngine method
dynamic
RenderEngine(
)
override
Implementation
@override
dynamic RenderEngine() {
List<Polyline> polylineList = [];
List<Marker> markerList = [];
List<Polygon> polygonList = [];
List<CircleMarker> circleList = [];
if (polyline != null) {
List<LatLng> points = [];
for (var element in polyline!.Points) {
points.add(LatLng(element.lat, element.lng));
}
polylineList.add(
Polyline(
points: points,
color: polyline!.color,
strokeWidth: 5,
pattern: polyline!.isSolidPattern
? const StrokePattern.solid()
: const StrokePattern.dotted()),
);
}
for (int i = 0; i < Markers.length; i++) {
var marker = Marker(
width: Markers[i].Width,
height: Markers[i].Height,
point: LatLng(Markers[i].Positions!.lat, Markers[i].Positions!.lng),
child: Builder(builder: (context) {
return RotationTransition(
turns: AlwaysStoppedAnimation(Markers[i].Bearing ?? 0),
child: InkWell(
onTap: () {
// Markers[i].Visible = !Markers[i].Visible;
TickerProvider vsync = Markers[i].onTap!();
_animatedMapMove(
destLocation: CoordinateRF(Markers[i].Positions!.lat,
Markers[i].Positions!.lng),
destZoom: 14,
vsync: vsync);
},
child:
// Markers[i].Visible
// ? Container(
// height: 100,
// width: 500,
// color: Colors.white,
// child: Image.asset(Markers[i].Image),
// )
Image.asset(Markers[i].Image)));
}),
rotate: false,
alignment: Alignment.center,
);
markerList.add(marker);
}
if (Fences != null) {
for (var element in Fences!) {
if (element is PolygonRF) {
List<LatLng> latLng = [];
for (var item in element.Points) {
latLng.add(LatLng(item.lat, item.lng));
}
polygonList.add(Polygon(
points: latLng,
color: element.color,
//strokeWidth: element.strokeWidth,
borderColor: element.BorderColor,
borderStrokeWidth: element.BorderStrokeWidth,
// hitValue:
));
} else if (element is CircleRF) {
circleList.add(CircleMarker(
point: LatLng(element.Points.lat, element.Points.lng),
radius: element.Radius,
borderStrokeWidth: element.BorderStrokeWidth,
borderColor: element.BorderColor,
color: element.color));
}
}
}
// final LayerHitNotifier<HitValue> hitNotifier = ValueNotifier(null);
return FlutterMap(
options: _options!,
mapController: _controller,
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.de/{z}/{x}/{y}.png',
userAgentPackageName: 'dev.fleaflet.flutter_map.example',
tileProvider: CancellableNetworkTileProvider(),
//tileBuilder: _darkModeTileBuilder,
),
RichAttributionWidget(
popupInitialDisplayDuration: const Duration(seconds: 0),
animationConfig: const ScaleRAWA(),
showFlutterMapAttribution: false,
attributions: [
TextSourceAttribution(
'OpenStreetMap contributors',
onTap: () async => launchUrl(
Uri.parse('https://openstreetmap.org/copyright'),
),
),
]),
PolylineLayer(polylines: polylineList),
GestureDetector(
onTap: () => OnPolygonTap == null ? null : OnPolygonTap!(),
child: PolygonLayer(
polygons: polygonList,
// hitNotifier: hitNotifier,
),
),
GestureDetector(
onTap: () => OnCircleTap == null ? null : OnCircleTap!(),
child: CircleLayer(
circles: circleList,
),
),
markerList.isEmpty || Markers[0].locationData == null
? MarkerLayer(
markers: markerList,
rotate: true,
)
: AnimatedMarkerLayer(
options: AnimatedMarkerLayerOptions(
duration: Duration(
milliseconds: Markers[2].Duration!,
),
marker: Marker(
width: 30,
height: 30,
alignment: Alignment.center,
point: LatLng(
Markers[2].Positions!.lat,
Markers[2].Positions!.lng,
),
child: Center(
child: Transform.rotate(
angle: max(0, Markers[0].locationData!.heading ?? 0) *
pi /
180,
child: Image.asset(
'assets/car.png',
),
),
),
),
),
),
// _permission ==LocationPermission .denied ||
// _permission == LocationPermission.deniedForever
// ? const SizedBox()
// : CurrentLocationLayer(),
],
);
}