v0.10.0flutter_map_animations
flutter_map 包中标记和控件的动画工具。
120喜欢 3.5万近 30 天下载150Pub 分数
AndroidiOSWebmacOSWindowsLinux
flutter_map 包中标记和控件的动画工具。
{"sdk":"flutter"}^8.3.0>=0.9.1 <0.11.0^3.0.0{"sdk":"flutter"}以下为英文项目原文快照,最新内容请访问 GitHub。
Pub Version (including pre-releases)
Animation utility for the flutter_map package.
Just create an AnimatedMapController and you're good to go:
class _MyWidgetState extends State<MyWidget> with TickerProviderStateMixin {
late final _animatedMapController = AnimatedMapController(vsync: this);
// ...
}
You can specify globally the animation's duration, curve and if previous animations should be stopped with cancelPreviousAnimations:
AnimatedMapController(
vsync: this,
duration: const Duration(milliseconds: 500),
curve: Curves.easeInOut,
cancelPreviousAnimations: true, // Default to false
);
And add it to your FlutterMap widget:
FlutterMap(
mapController: _animatedMapController.mapController,
// ...
)
| Rotation | Zoom | Center on point |
|---|---|---|
| https://github.com/TesteurManiak/flutter_map_animations/blob/main/gifs/rotate.gif?raw=true | https://github.com/TesteurManiak/flutter_map_animations/blob/main/gifs/zoom.gif?raw=true | https://github.com/TesteurManiak/flutter_map_animations/blob/main/gifs/center-on-point.gif?raw=true |
Check the AnimatedMapController API for more!
| AnimatedMarker |
|---|
| https://raw.githubusercontent.com/TesteurManiak/flutter_map_animations/main/gifs/animated-marker.gif |
FlutterMap(
mapController: _animatedMapController.mapController,
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'com.example.app',
),
AnimatedMarkerLayer(
markers: [
AnimatedMarker(
point: LatLng(51.509364, -0.128928),
builder: (_, animation) {
final size = 50.0 * animation.value;
return Icon(
Icons.location_on,
size: size,
);
},
),
],
),
],
)
With flutter_map v6 some parameters have been removed or renamed:
AnimatedMarker.rotateOrigin, AnimatedMarker.anchorPos have been removedAnimatedMarker.rotateAlignment has been renamed to AnimatedMarker.alignmentAnimatedMarkerLayer.rotateOrigin, AnimatedMarkerLayer.anchorPos have been removedAnimatedMarkerLayer.rotateAlignment has been renamed to AnimatedMarkerLayer.alignmentMapControllerImpl which was used to use the AnimatedMapController directly as a MapController in the FlutterMap widget. Now an instance of MapController is created internally or can be passed as a parameter to the AnimatedMapController constructor. You can access it with the mapController getter:late final _animatedMapController = AnimatedMapController(vsync: this);
@override
Widget build(BuildContext context) {
return FlutterMap(
mapController: _animatedMapController.mapController,
// ...
);
}
|
TesteurManiak
Guillaume Roux |
JaffaKetchup
Luka S |
rorystephenson
Rory Stephenson |
ReinisSprogis
Reinis Sprogis |