Easy Street View
The easiest Street View plugin which U can imagine!
🔥 Key Features
-
Easy Integration: Adding a Street View is a matter of seconds.
-
Platform Support: Works on Android
-
Direct Navigation: Just provide the latitude and longitude.
⚙️ Installation
1. Add easy_street_view to your pubspec.yaml file:
dependencies:
easy_street_view: ^0.0.1
2. Then run:
flutter pub get
3. Configure AndroidManifest.xml
For the Street View to function correctly, you must add the Internet permission to the android/app/src/main/AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
💻 Implementation Example
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:easy_street_view/easy_street_view.dart';
void main() {
runApp(const StreetViewApp());
}
class StreetViewApp extends StatelessWidget {
const StreetViewApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: const StreetViewExample(),
);
}
}
class StreetViewExample extends StatefulWidget {
const StreetViewExample({super.key});
@override
State<StreetViewExample> createState() => _StreetViewExampleState();
}
class _StreetViewExampleState extends State<StreetViewExample> {
Set<Marker> markers = {};
@override
Widget build(BuildContext context) {
return Scaffold(
body:
Column(children: [
Expanded(
flex: 5,
child: StreetView(
latitude: 52.230988,
longitude: 21.004221)),
Expanded(
flex: 5,
child: GoogleMap(
onTap: (position){
streetViewNewPosition(position.longitude, position.latitude);
setState(() {
markers.removeWhere((Marker)=> Marker.markerId == MarkerId('My Position'));
markers.add(
Marker(
markerId: MarkerId('My Position'),
position: LatLng(position.latitude, position.longitude)
));
});
},
markers: markers,
initialCameraPosition:
CameraPosition(target: LatLng(52.230988, 21.004221), zoom: 20))),
])
);
}
}