Skip to content

Commit

Permalink
fix broken Map.center_on() and default animations (flet-dev#4519)
Browse files Browse the repository at this point in the history
* fix center_on

* get default animation duration and curve
  • Loading branch information
ndonkoHenri authored and syleishere committed Dec 14, 2024
1 parent 8d93d6e commit 6516886
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/flet_map/lib/src/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ class _MapControlState extends State<MapControl>
.where((c) => c.isVisible && (acceptedChildrenTypes.contains(c.type)))
.toList();

Curve? defaultAnimationCurve;
Duration? defaultAnimationDuration;
Curve? defaultAnimationCurve =
parseCurve(widget.control.attrString("animationCurve"));
Duration? defaultAnimationDuration =
parseDuration(widget.control, "animationDuration");
var configuration = parseConfiguration(
widget.control, widget.backend, context, const MapOptions())!;

Expand All @@ -76,7 +78,7 @@ class _MapControlState extends State<MapControl>
if (degree != null) {
_animatedMapController.animatedRotateFrom(
degree,
curve: parseCurve(args["curve"]) ?? defaultAnimationCurve,
curve: parseCurve(args["curve"], defaultAnimationCurve),
);
}
case "reset_rotation":
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet/src/flet/core/map/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def center_on(
animation_duration: DurationValue = None,
):
self.invoke_method(
"animate_to",
"center_on",
arguments={
"lat": str(point.latitude) if point else None,
"long": str(point.longitude) if point else None,
Expand Down

0 comments on commit 6516886

Please sign in to comment.