|
| 1 | +// Copyright 2013 The Flutter Authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; |
| 6 | +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; |
| 7 | + |
| 8 | +/// The interface that platform-specific implementations of |
| 9 | +/// `google_maps_flutter` can extend to support state inpsection in tests. |
| 10 | +/// |
| 11 | +/// Avoid `implements` of this interface. Using `implements` makes adding any |
| 12 | +/// new methods here a breaking change for end users of your platform! |
| 13 | +/// |
| 14 | +/// Do `extends GoogleMapsInspectorPlatform` instead, so new methods |
| 15 | +/// added here are inherited in your code with the default implementation (that |
| 16 | +/// throws at runtime), rather than breaking your users at compile time. |
| 17 | +abstract class GoogleMapsInspectorPlatform extends PlatformInterface { |
| 18 | + /// Constructs a GoogleMapsFlutterPlatform. |
| 19 | + GoogleMapsInspectorPlatform() : super(token: _token); |
| 20 | + |
| 21 | + static final Object _token = Object(); |
| 22 | + |
| 23 | + static GoogleMapsInspectorPlatform? _instance; |
| 24 | + |
| 25 | + /// The instance of [GoogleMapsInspectorPlatform], if any. |
| 26 | + /// |
| 27 | + /// This is usually populated by calling |
| 28 | + /// [GoogleMapsFlutterPlatform.enableDebugInspection]. |
| 29 | + static GoogleMapsInspectorPlatform? get instance => _instance; |
| 30 | + |
| 31 | + /// Platform-specific plugins should set this with their own platform-specific |
| 32 | + /// class that extends [GoogleMapsInspectorPlatform] in their |
| 33 | + /// implementation of [GoogleMapsFlutterPlatform.enableDebugInspection]. |
| 34 | + static set instance(GoogleMapsInspectorPlatform? instance) { |
| 35 | + if (instance != null) { |
| 36 | + PlatformInterface.verify(instance, _token); |
| 37 | + } |
| 38 | + _instance = instance; |
| 39 | + } |
| 40 | + |
| 41 | + /// Returns the minimum and maxmimum zoom level settings. |
| 42 | + Future<MinMaxZoomPreference> getMinMaxZoomLevels({required int mapId}) { |
| 43 | + throw UnimplementedError('getMinMaxZoomLevels() has not been implemented.'); |
| 44 | + } |
| 45 | + |
| 46 | + /// Returns true if the compass is enabled. |
| 47 | + Future<bool> isCompassEnabled({required int mapId}) { |
| 48 | + throw UnimplementedError('isCompassEnabled() has not been implemented.'); |
| 49 | + } |
| 50 | + |
| 51 | + /// Returns true if lite mode is enabled. |
| 52 | + Future<bool> isLiteModeEnabled({required int mapId}) { |
| 53 | + throw UnimplementedError('isLiteModeEnabled() has not been implemented.'); |
| 54 | + } |
| 55 | + |
| 56 | + /// Returns true if the map toolbar is enabled. |
| 57 | + Future<bool> isMapToolbarEnabled({required int mapId}) { |
| 58 | + throw UnimplementedError('isMapToolbarEnabled() has not been implemented.'); |
| 59 | + } |
| 60 | + |
| 61 | + /// Returns true if the "my location" button is enabled. |
| 62 | + Future<bool> isMyLocationButtonEnabled({required int mapId}) { |
| 63 | + throw UnimplementedError( |
| 64 | + 'isMyLocationButtonEnabled() has not been implemented.'); |
| 65 | + } |
| 66 | + |
| 67 | + /// Returns true if the traffic overlay is enabled. |
| 68 | + Future<bool> isTrafficEnabled({required int mapId}) { |
| 69 | + throw UnimplementedError('isTrafficEnabled() has not been implemented.'); |
| 70 | + } |
| 71 | + |
| 72 | + /// Returns true if the building layer is enabled. |
| 73 | + Future<bool> areBuildingsEnabled({required int mapId}) { |
| 74 | + throw UnimplementedError('areBuildingsEnabled() has not been implemented.'); |
| 75 | + } |
| 76 | + |
| 77 | + /// Returns true if rotate gestures are enabled. |
| 78 | + Future<bool> areRotateGesturesEnabled({required int mapId}) { |
| 79 | + throw UnimplementedError( |
| 80 | + 'areRotateGesturesEnabled() has not been implemented.'); |
| 81 | + } |
| 82 | + |
| 83 | + /// Returns true if scroll gestures are enabled. |
| 84 | + Future<bool> areScrollGesturesEnabled({required int mapId}) { |
| 85 | + throw UnimplementedError( |
| 86 | + 'areScrollGesturesEnabled() has not been implemented.'); |
| 87 | + } |
| 88 | + |
| 89 | + /// Returns true if tilt gestures are enabled. |
| 90 | + Future<bool> areTiltGesturesEnabled({required int mapId}) { |
| 91 | + throw UnimplementedError( |
| 92 | + 'areTiltGesturesEnabled() has not been implemented.'); |
| 93 | + } |
| 94 | + |
| 95 | + /// Returns true if zoom controls are enabled. |
| 96 | + Future<bool> areZoomControlsEnabled({required int mapId}) { |
| 97 | + throw UnimplementedError( |
| 98 | + 'areZoomControlsEnabled() has not been implemented.'); |
| 99 | + } |
| 100 | + |
| 101 | + /// Returns true if zoom gestures are enabled. |
| 102 | + Future<bool> areZoomGesturesEnabled({required int mapId}) { |
| 103 | + throw UnimplementedError( |
| 104 | + 'areZoomGesturesEnabled() has not been implemented.'); |
| 105 | + } |
| 106 | + |
| 107 | + /// Returns information about the tile overlay with the given ID. |
| 108 | + /// |
| 109 | + /// The returned object will be synthesized from platform data, so will not |
| 110 | + /// be the same Dart object as the original [TileOverlay] provided to the |
| 111 | + /// platform interface with that ID, and not all fields (e.g., |
| 112 | + /// [TileOverlay.tileProvider]) will be populated. |
| 113 | + Future<TileOverlay?> getTileOverlayInfo(TileOverlayId tileOverlayId, |
| 114 | + {required int mapId}) { |
| 115 | + throw UnimplementedError('getTileOverlayInfo() has not been implemented.'); |
| 116 | + } |
| 117 | +} |
0 commit comments