Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review comments from issues/829-nullsafety #919

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ This version has support for sound null safety. For this purpose, some inactive
- Sound null safety migration (#851, #870)
- requires flutter version 2.0.0 or higher
- latlong is replaced with latlong2
- ready-flag on map has been removed
- Remove the package flutter_image and add http instead (#894)
- http has to be version 0.13.2 or higher for this package (#894)
- Removed deprecated properties
- debug property has been removed
- interactive has been replaced by interactiveFlags
- Bounds getCenter has been replaced by center getter

Thanks to escamoteur, ThexXTURBOXx, Sata51, tazik561, kengu, passsy, Ahmed-gubara, johnpryan and josxha for this release!
Thanks to escamoteur, ThexXTURBOXx, Sata51, tazik561, kengu, passsy, Ahmed-gubara, johnpryan, josxha and andreandersson for this release!

## [0.12.0] - 3/16/2021
TileLayerOptions now takes some additional options, templateFunction,
Expand Down
1 change: 0 additions & 1 deletion example/lib/pages/custom_crs/custom_crs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class _CustomCrsPageState extends State<CustomCrsPage> {
// EPSG:3413 is a user-defined projection from a valid Proj4 definition string
// From: http://epsg.io/3413, proj definition: http://epsg.io/3413.proj4
// Find Projection by name or define it if not exists
// TODO the warning here will go away as soon as proj4 is migrated to null safety
epsg3413 = proj4.Projection.get('EPSG:3413') ??
proj4.Projection.add('EPSG:3413',
'+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs');
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/network_tile_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class NetworkTileProviderPage extends StatelessWidget {
Padding(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
child: Wrap(children: [
Text('This is a map that is using NetworkTileProvider.'),
Text('Turn on flight mode to see that images are cached.'),
Text('This Provider does not provide caching.'),
Text('For further options about that, check flutter_map\'s README on GitHub.'),
]),
),
Flexible(
Expand Down
19 changes: 3 additions & 16 deletions lib/flutter_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ abstract class MapController {
/// through the [options] parameter.
void fitBounds(LatLngBounds bounds, {FitBoundsOptions? options});

bool get ready;

Future<Null> get onReady;

LatLng get center;
Expand Down Expand Up @@ -221,10 +219,6 @@ class MapOptions {

final double? minZoom;
final double? maxZoom;
@deprecated
final bool debug; // TODO no usage outside of constructor. Marked for removal?
@Deprecated('use interactiveFlags instead')
final bool? interactive;

/// see [InteractiveFlag] for custom settings
final int interactiveFlags;
Expand Down Expand Up @@ -268,12 +262,7 @@ class MapOptions {
MultiFingerGesture.pinchZoom | MultiFingerGesture.pinchMove,
this.minZoom,
this.maxZoom,
@Deprecated('') this.debug = false,
@Deprecated('Use interactiveFlags instead') this.interactive,
// TODO: Change when [interactive] is removed.
// Change this to [this.interactiveFlags = InteractiveFlag.all] and remove
// [interactiveFlags] from initializer list
int? interactiveFlags,
this.interactiveFlags = InteractiveFlag.all,
this.allowPanning = true,
this.onTap,
this.onLongPress,
Expand All @@ -286,9 +275,7 @@ class MapOptions {
this.controller,
this.swPanBoundary,
this.nePanBoundary,
}) : interactiveFlags = interactiveFlags ??
(interactive == false ? InteractiveFlag.none : InteractiveFlag.all),
center = center ?? LatLng(50.5, 30.51),
}) : center = center ?? LatLng(50.5, 30.51),
assert(rotationThreshold >= 0.0),
assert(pinchZoomThreshold >= 0.0),
assert(pinchMoveThreshold >= 0.0) {
Expand Down Expand Up @@ -365,7 +352,7 @@ class MapOptions {
double _calculateScreenHeightInDegrees() =>
screenSize!.height * 170.102258 / pow(2, _getControllerZoom() + 8);

double _getControllerZoom() => controller!.ready ? controller!.zoom : zoom;
double _getControllerZoom() => controller!.zoom;
}

class FitBoundsOptions {
Expand Down
11 changes: 4 additions & 7 deletions lib/src/core/bounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ class Bounds<T extends num> {
}

/// This [Bounds] central point.
CustomPoint<double> getCenter() {
//TODO should this be a getter?
return CustomPoint<double>(
(min.x + max.x) / 2,
(min.y + max.y) / 2,
);
}
CustomPoint<double> get center => CustomPoint<double>(
(min.x + max.x) / 2,
(min.y + max.y) / 2,
);

/// Bottom-Left corner's point.
CustomPoint<T> get bottomLeft => CustomPoint(min.x, max.y);
Expand Down
6 changes: 2 additions & 4 deletions lib/src/layer/tile_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ class TileLayerOptions extends LayerOptions {
final double opacity;

/// Provider to load the tiles. The default is CachedNetworkTileProvider,
/// which loads tile images from network and caches them offline.
///
/// If you don't want to cache the tiles, use NetworkTileProvider instead.
/// which loads tile images from network.
///
/// In order to use images from the asset folder set this option to
/// AssetTileProvider() Note that it requires the urlTemplate to target
Expand Down Expand Up @@ -925,7 +923,7 @@ class _TileLayerState extends State<TileLayer> with TickerProviderStateMixin {

var pixelBounds = _getTiledPixelBounds(center);
var tileRange = _pxBoundsToTileRange(pixelBounds);
var tileCenter = tileRange.getCenter();
var tileCenter = tileRange.center;
final queue = <Coords<num>>[];
var margin = options.keepBuffer;
var noPruneRange = Bounds(
Expand Down
4 changes: 0 additions & 4 deletions lib/src/map/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ class MapControllerImpl implements MapController {
_state.fitBounds(bounds, options!);
}

@override
// TODO Remove getter since ready is always true (breaking change, was '=> _state != null' when state is never null)
bool get ready => true;

@override
LatLng get center => _state.center;

Expand Down