ar_location_view 3.2.0
ar_location_view: ^3.2.0 copied to clipboard
Location-based augmented reality: shows labels for geolocated points of interest over the camera preview, stacked so that every POI stays visible.
example/lib/main.dart
import 'package:ar_location_view_example/annotation_view.dart';
import 'package:ar_location_view_example/annotations.dart';
import 'package:flutter/material.dart';
import 'package:ar_location_view/ar_location_view.dart';
import 'package:geolocator/geolocator.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
List<Annotation> annotations = [];
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: ArLocationWidget(
annotations: annotations,
showDebugInfoSensor: false,
annotationWidth: 180,
annotationHeight: 60,
yOffsetOverlap: 20,
radarPosition: RadarPosition.bottomCenter,
annotationViewBuilder: (context, annotation) {
return AnnotationView(
key: ValueKey(annotation.uid),
annotation: annotation as Annotation,
);
},
radarWidth: 160,
scaleWithDistance: false,
onLocationChange: (Position position) {
Future.delayed(const Duration(seconds: 5), () {
annotations = fakeAnnotation(
position: position,
numberMaxPoi: 10,
);
setState(() {});
});
},
),
),
);
}
}