additionalController;
Future<bool> get locationPermissionNotGranted async => !(await Permission.location.request().isGranted);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: YandexMap(
onMapCreated: (YandexMapController yandexMapController) async {
setState(() {
controller = yandexMapController;
});
},
onUserLocationAdded: (UserLocationView view) async {
return view.copyWith(
arrow: view.arrow.copyWith(
icon: PlacemarkIcon.single(
PlacemarkIconStyle(image: BitmapDescriptor.fromAssetImage('lib/assets/arrow.png'))
)
),
accuracyCircle: view.accuracyCircle.copyWith(
fillColor: Colors.green.withOpacity(0.5)
)
);
},
)
),
]
);
}
Future<void> clickBottomButton() async {
if (await locationPermissionNotGranted) {
_showMessage(context, const Text('Location permission was NOT granted'));
return;
}
await controller!.toggleUserLayer(visible: true);
}
void _showMessage(BuildContext context, Text text) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: text));
}
}
А где ты ее инициализируешь?
А какая ошибка выходи?
Обсуждают сегодня