diff --git a/lib/src/map/internal_controller.dart b/lib/src/map/internal_controller.dart index e97e54503..053842a01 100644 --- a/lib/src/map/internal_controller.dart +++ b/lib/src/map/internal_controller.dart @@ -156,13 +156,13 @@ class FlutterMapInternalController extends ValueNotifier<_InternalState> { } if (degree == camera.rotation) { - return const MoveAndRotateResult(false, false); + return const (moveSuccess: false, rotateSuccess: false); } if (offset == Offset.zero) { - return MoveAndRotateResult( - true, - rotate( + return ( + moveSuccess: true, + rotateSuccess: rotate( degree, hasGesture: hasGesture, source: source, @@ -178,8 +178,8 @@ class FlutterMapInternalController extends ValueNotifier<_InternalState> { : Point(offset!.dx, offset.dy)) .rotate(camera.rotationRad); - return MoveAndRotateResult( - move( + return ( + moveSuccess: move( camera.unproject( rotationCenter + (camera.project(camera.center) - rotationCenter) @@ -191,7 +191,7 @@ class FlutterMapInternalController extends ValueNotifier<_InternalState> { source: source, id: id, ), - rotate( + rotateSuccess: rotate( camera.rotation + rotationDiff, hasGesture: hasGesture, source: source, @@ -212,8 +212,8 @@ class FlutterMapInternalController extends ValueNotifier<_InternalState> { required MapEventSource source, required String? id, }) => - MoveAndRotateResult( - move( + ( + moveSuccess: move( newCenter, newZoom, offset: offset, @@ -221,7 +221,8 @@ class FlutterMapInternalController extends ValueNotifier<_InternalState> { source: source, id: id, ), - rotate(newRotation, id: id, source: source, hasGesture: hasGesture), + rotateSuccess: + rotate(newRotation, id: id, source: source, hasGesture: hasGesture), ); /// Note: All named parameters are required to prevent inconsistent default diff --git a/lib/src/map/map_controller.dart b/lib/src/map/map_controller.dart index c5a6523a9..e16c2289f 100644 --- a/lib/src/map/map_controller.dart +++ b/lib/src/map/map_controller.dart @@ -109,8 +109,8 @@ abstract class MapController { /// The emitted [MapEventRotate.source]/[MapEventMove.source] properties will /// be [MapEventSource.mapController]. /// - /// The operation was successful if [MoveAndRotateResult.moveSuccess] and - /// [MoveAndRotateResult.rotateSuccess] are `true`. + /// The operation was successful if both fields of the resulting record are + /// `true`. MoveAndRotateResult rotateAroundPoint( double degree, { Point? point, @@ -125,8 +125,8 @@ abstract class MapController { /// /// See documentation on those methods for more details. /// - /// The operation was successful if [MoveAndRotateResult.moveSuccess] and - /// [MoveAndRotateResult.rotateSuccess] are `true`. + /// The operation was successful if both fields of the resulting record are + /// `true`. MoveAndRotateResult moveAndRotate( LatLng center, double zoom, diff --git a/lib/src/misc/move_and_rotate_result.dart b/lib/src/misc/move_and_rotate_result.dart index b3431e287..b6887349f 100644 --- a/lib/src/misc/move_and_rotate_result.dart +++ b/lib/src/misc/move_and_rotate_result.dart @@ -1,9 +1 @@ -import 'package:meta/meta.dart'; - -@immutable -class MoveAndRotateResult { - final bool moveSuccess; - final bool rotateSuccess; - - const MoveAndRotateResult(this.moveSuccess, this.rotateSuccess); -} +typedef MoveAndRotateResult = ({bool moveSuccess, bool rotateSuccess});