geo json integrated.

main_production_asset_tracking
Sikander Saleem 4 weeks ago
parent 0863447e17
commit 2f3bb5ba7d

File diff suppressed because one or more lines are too long

@ -0,0 +1,55 @@
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)
),
],
),
],
),
);
}
}

@ -64,6 +64,9 @@ dependencies:
pinput: ^6.0.2
audioplayers: ^6.6.0
mobile_scanner: ^7.2.0
flutter_map: ^8.3.2
latlong2: ^0.9.0
flutter_map_geojson2: ^1.0.2
flare_flutter:
git:

Loading…
Cancel
Save