added current location marker
This commit is contained in:
@ -105,6 +105,7 @@ class _HomePageState extends State<HomeView> {
|
||||
mapState.setLoading(true);
|
||||
LatLng? latLng = await getLatLng();
|
||||
if (latLng != null) {
|
||||
mapState.setCurrentLocation(latLng);
|
||||
mapState.getMapController.move(latLng, 16);
|
||||
}
|
||||
mapState.setLoading(false);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:app/extensions/obtainProviderExtension.dart';
|
||||
import 'package:app/state/mapState.dart';
|
||||
import 'package:app/util/watchState.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:http/http.dart';
|
||||
@ -49,7 +50,37 @@ class _MapViewState extends State<MapView> {
|
||||
)
|
||||
)
|
||||
],
|
||||
) : const SizedBox.shrink())
|
||||
) : const SizedBox.shrink()),
|
||||
WatchState<MapState>((context, state) => MarkerLayer(
|
||||
markers: [
|
||||
if (state.getActiveMarker != null) Marker(
|
||||
point: state.getActiveMarker!,
|
||||
child: const Icon(
|
||||
Icons.location_on,
|
||||
color: Colors.red,
|
||||
size: 48,
|
||||
)
|
||||
),
|
||||
if (state.getCurrentLocation != null) Marker(
|
||||
point: state.getCurrentLocation!,
|
||||
child: const Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.circle,
|
||||
color: Colors.white,
|
||||
size: 23,
|
||||
),
|
||||
Icon(
|
||||
Icons.circle,
|
||||
color: Color.fromARGB(255, 0, 200, 0),
|
||||
size: 16,
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
]
|
||||
))
|
||||
],
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user