amap_map_fluttify
This commit is contained in:
11
example/lib/utils/misc.dart
Normal file
11
example/lib/utils/misc.dart
Normal file
@ -0,0 +1,11 @@
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
Future<bool> requestPermission() async {
|
||||
final status = await Permission.location.request();
|
||||
|
||||
if (status == PermissionStatus.granted) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
25
example/lib/utils/next_latlng.dart
Normal file
25
example/lib/utils/next_latlng.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
|
||||
|
||||
mixin NextLatLng {
|
||||
final random = Random();
|
||||
|
||||
LatLng getNextLatLng({ LatLng? center}) {
|
||||
center ??= LatLng(39.90960, 116.397228);
|
||||
return LatLng(
|
||||
center.latitude + random.nextDouble(),
|
||||
center.longitude + random.nextDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
List<LatLng> getNextBatchLatLng(int count) {
|
||||
return [
|
||||
for (int i = 0; i < count; i++)
|
||||
LatLng(
|
||||
39.90960 + random.nextDouble() * 4,
|
||||
116.397228 + random.nextDouble() * 4,
|
||||
)
|
||||
];
|
||||
}
|
||||
}
|
1
example/lib/utils/utils.export.dart
Normal file
1
example/lib/utils/utils.export.dart
Normal file
@ -0,0 +1 @@
|
||||
export 'misc.dart';
|
Reference in New Issue
Block a user