-
-
Notifications
You must be signed in to change notification settings - Fork 893
Closed as not planned
Labels
invalidThis bug isn't reproducible, or the feature already existsThis bug isn't reproducible, or the feature already exists
Description
What is the bug?
Hello.
I'm using flutter_map: ^8.1.1 like follow:
return StreamBuilder<
List<Marker>>(
stream:
carMarkerStream,
builder: (context,
snapshot) {
return fm
.FlutterMap(
mapController:
_fmController,
options: fm
.MapOptions(
onMapEvent:
(v) async {
if (v.source == fm.MapEventSource.nonRotatedSizeChange &&
addressList.isEmpty) {
_centerLocation =
LatLng(v.camera.center.latitude, v.camera.center.longitude);
setState(() {});
var val =
await geoCoding(_centerLocation.latitude, _centerLocation.longitude);
if (val !=
'') {
setState(() {
if (addressList.where((element) => element.type == 'pickup').isNotEmpty) {
var add = addressList.firstWhere((element) => element.type == 'pickup');
add.address = val;
add.latlng = LatLng(_centerLocation.latitude, _centerLocation.longitude);
} else {
addressList.add(AddressList(id: '1', type: 'pickup', address: val, pickup: true, latlng: LatLng(_centerLocation.latitude, _centerLocation.longitude), name: userDetails['name'], number: userDetails['mobile']));
}
});
_lastCenter = _centerLocation;
ischanged = false;
}
}
if (v.source ==
fm.MapEventSource.dragEnd) {
_centerLocation =
LatLng(v.camera.center.latitude, v.camera.center.longitude);
setState(() {});
if (userDetails['enable_map_location_icon_drag_and_drop_feature'] ==
'0') {
var val = await geoCoding(_centerLocation.latitude, _centerLocation.longitude);
lowerLat = _centerLocation.latitude - (lat * 1.24);
lowerLon = _centerLocation.longitude - (lon * 1.24);
greaterLat = _centerLocation.latitude + (lat * 1.24);
greaterLon = _centerLocation.longitude + (lon * 1.24);
lower = geo.encode(lowerLon, lowerLat);
higher = geo.encode(greaterLon, greaterLat);
fdb = FirebaseDatabase.instance.ref('drivers').orderByChild('g').startAt(lower).endAt(higher);
if (val != '') {
setState(() {
if (addressList.where((element) => element.type == 'pickup').isNotEmpty) {
var add = addressList.firstWhere((element) => element.type == 'pickup');
add.address = val;
add.latlng = LatLng(_centerLocation.latitude, _centerLocation.longitude);
} else {
addressList.add(AddressList(id: '1', type: 'pickup', address: val, pickup: true, latlng: LatLng(_centerLocation.latitude, _centerLocation.longitude), name: userDetails['name'], number: userDetails['mobile']));
}
});
_lastCenter = _centerLocation;
ischanged = false;
}
}
}
},
onPositionChanged: (p,
l) async {
if (l ==
false) {
if (addressList.isEmpty) {
_centerLocation = LatLng(p.center.latitude, p.center.longitude);
setState(() {});
var val = await geoCoding(_centerLocation.latitude, _centerLocation.longitude);
lowerLat = _centerLocation.latitude - (lat * 1.24);
if (val != '') {
setState(() {
if (addressList.where((element) => element.type == 'pickup').isNotEmpty) {
var add = addressList.firstWhere((element) => element.type == 'pickup');
add.address = val;
add.latlng = LatLng(_centerLocation.latitude, _centerLocation.longitude);
} else {
addressList.add(AddressList(id: '1', type: 'pickup', address: val, pickup: true, latlng: LatLng(_centerLocation.latitude, _centerLocation.longitude), name: userDetails['name'], number: userDetails['mobile']));
}
});
_lastCenter = _centerLocation;
ischanged = false;
}
}
}
},
// interactiveFlags: ~fm
// .InteractiveFlag
// .doubleTapZoom,
initialCenter: fmlt.LatLng(
center
.latitude,
center
.longitude),
initialZoom:
16,
onTap: (P,
L) {}),
children: [
fm.TileLayer(
// minZoom: 10,
urlTemplate: (isDarkTheme ==
false)
? 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
: 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',
// subdomains: ['a', 'b', 'c', 'd'],
userAgentPackageName:
'com.example.app',
),
fm.MarkerLayer(
markers: myMarkers
.asMap()
.map(
(k, value) =>
MapEntry(
k,
fm.Marker(
alignment: Alignment.topCenter,
point: fmlt.LatLng(myMarkers[k].position.latitude, myMarkers[k].position.longitude),
width: media.width * 0.7,
height: 50,
child: RotationTransition(
turns: AlwaysStoppedAnimation(myMarkers[k].rotation / 360),
child: Image.asset(
(myMarkers[k].markerId.toString().replaceAll('MarkerId(', '').replaceAll(')', '').split('#')[2].toString() == 'taxi')
? 'assets/images/top-taxi.png'
: (myMarkers[k].markerId.toString().replaceAll('MarkerId(', '').replaceAll(')', '').split('#')[2].toString() == 'truck')
? 'assets/images/dev.png'
: 'assets/images/bicy.png',
),
),
),
),
)
.values
.toList(),
),
const fm
.RichAttributionWidget(
attributions: [],
),
],
);
});
But, as you can see on the Screen Shot below, it is hidden. I try anything I know but it does display at all:
I want to point out that sometimes the map displays very well but other times it hides.
Please, I really need your help.
Do you have a potential solution?
No response
Metadata
Metadata
Assignees
Labels
invalidThis bug isn't reproducible, or the feature already existsThis bug isn't reproducible, or the feature already exists
