You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/modules/asset_tracking/asset_tracking_page.dart

56 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_geojson2/flutter_map_geojson2.dart';
import 'package:latlong2/latlong.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
class AssetTrackingPage extends StatefulWidget {
AssetTrackingPage({Key? key}) : super(key: key);
@override
_AssetTrackingPageState createState() {
return _AssetTrackingPageState();
}
}
class _AssetTrackingPageState extends State<AssetTrackingPage> {
// Bounds computed from assets/floor.geojson so the floor plan is visible immediately.
static final LatLngBounds _floorBounds = LatLngBounds(
const LatLng(24.81155194782686, 46.62383802969581),
const LatLng(24.81245295363478, 46.62470917292456),
);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const DefaultAppBar(title: "Live Asset Tracking"),
body: FlutterMap(
options: MapOptions(
initialCenter: const LatLng(24.81200245073082, 46.624273601310186),
initialZoom: 16.0,
initialCameraFit: CameraFit.bounds(bounds: _floorBounds, padding: const EdgeInsets.all(24)),
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'com.hmg.atoms',
),
GeoJsonLayer.asset(
'assets/floor.geojson',
styleDefaults: GeoJsonStyleDefaults.leaflet,
),
RichAttributionWidget(
attributions: [
TextSourceAttribution(
'OpenStreetMap contributors',
onTap: () {}, // (external)
),
],
),
],
),
);
}
}