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

Add Flutter 3 Compatibility #1236

Merged
merged 3 commits into from
May 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
include: package:flutter_lints/flutter.yaml
linter:
rules:
- always_declare_return_types
- avoid_returning_null
- avoid_unused_constructor_parameters
- cancel_subscriptions
- comment_references
- directives_ordering
- invariant_booleans
- no_adjacent_strings_in_list
- omit_local_variable_types
- only_throw_errors
- prefer_interpolation_to_compose_strings
- prefer_single_quotes
- sort_pub_dependencies
- test_types_in_equals
- throw_in_finally
- unnecessary_lambdas
- unnecessary_null_aware_assignments
- unnecessary_statements
library_private_types_in_public_api: false
4 changes: 4 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
linter:
rules:
library_private_types_in_public_api: false
10 changes: 5 additions & 5 deletions example/lib/pages/animated_map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class AnimatedMapControllerPageState extends State<AnimatedMapControllerPage>
void _animatedMapMove(LatLng destLocation, double destZoom) {
// Create some tweens. These serve to split up the transition from one location to another.
// In our case, we want to split the transition be<tween> our current map center and the destination.
final _latTween = Tween<double>(
final latTween = Tween<double>(
begin: mapController.center.latitude, end: destLocation.latitude);
final _lngTween = Tween<double>(
final lngTween = Tween<double>(
begin: mapController.center.longitude, end: destLocation.longitude);
final _zoomTween = Tween<double>(begin: mapController.zoom, end: destZoom);
final zoomTween = Tween<double>(begin: mapController.zoom, end: destZoom);

// Create a animation controller that has a duration and a TickerProvider.
var controller = AnimationController(
Expand All @@ -58,8 +58,8 @@ class AnimatedMapControllerPageState extends State<AnimatedMapControllerPage>

controller.addListener(() {
mapController.move(
LatLng(_latTween.evaluate(animation), _lngTween.evaluate(animation)),
_zoomTween.evaluate(animation));
LatLng(latTween.evaluate(animation), lngTween.evaluate(animation)),
zoomTween.evaluate(animation));
});

animation.addStatusListener((status) {
Expand Down
8 changes: 4 additions & 4 deletions example/lib/pages/tile_loading_error_handle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TileLoadingErrorHandle extends StatefulWidget {
class _TileLoadingErrorHandleState extends State<TileLoadingErrorHandle> {
@override
Widget build(BuildContext context) {
var _needLoadingError = true;
var needLoadingError = true;

return Scaffold(
appBar: AppBar(title: const Text('Tile Loading Error Handle')),
Expand All @@ -36,7 +36,7 @@ class _TileLoadingErrorHandleState extends State<TileLoadingErrorHandle> {
center: LatLng(51.5, -0.09),
zoom: 5.0,
onPositionChanged: (MapPosition mapPosition, bool _) {
_needLoadingError = true;
needLoadingError = true;
},
),
layers: [
Expand All @@ -49,7 +49,7 @@ class _TileLoadingErrorHandleState extends State<TileLoadingErrorHandle> {
// NetworkTileProvider or CachedNetworkTileProvider
tileProvider: const NonCachingNetworkTileProvider(),
errorTileCallback: (Tile tile, error) {
if (_needLoadingError) {
if (needLoadingError) {
WidgetsBinding.instance.addPostFrameCallback((_) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
duration: const Duration(seconds: 1),
Expand All @@ -60,7 +60,7 @@ class _TileLoadingErrorHandleState extends State<TileLoadingErrorHandle> {
backgroundColor: Colors.deepOrange,
));
});
_needLoadingError = false;
needLoadingError = false;
}
},
),
Expand Down
68 changes: 9 additions & 59 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,29 @@
name: flutter_map_example
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
description: Example application for 'flutter_map' package
publish_to: "none"
version: 1.0.0

environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=2.12.0 <3.0.0"

dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
flutter_map:
path: ../
location: ^4.1.1
location: ^4.4.0
latlong2: ^0.8.1
proj4dart: ^2.0.0
positioned_tap_detector_2: ^1.0.4

dev_dependencies:
flutter_lints: ^1.0.4
flutter_lints: ">=1.0.4"
flutter_test:
sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
assets:
- assets/map/anholt_osmbright/12/2177/
- assets/map/anholt_osmbright/12/2178/
Expand Down Expand Up @@ -81,31 +59,3 @@ flutter:
- assets/map/anholt_osmbright/14/8725/
- assets/map/anholt_osmbright/14/8726/
- assets/map/anholt_osmbright/14/8727/



# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
6 changes: 3 additions & 3 deletions lib/src/gestures/gestures.dart
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,10 @@ abstract class MapGestureMixin extends State<FlutterMap>
mapState.originalSize!.y as double))
.shortestSide;

var _flingOffset = _focalStartLocal - _lastFocalLocal;
var flingOffset = _focalStartLocal - _lastFocalLocal;
_flingAnimation = Tween<Offset>(
begin: _flingOffset,
end: _flingOffset - direction * distance,
begin: flingOffset,
end: flingOffset - direction * distance,
).animate(_flingController);

_flingController
Expand Down
12 changes: 6 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: flutter_map
description: A Dart implementation of Leaflet to provide a Map widget for Flutter apps
version: 0.14.0
version: 0.15.0
repository: https://github.com/fleaflet/flutter_map

environment:
sdk: '>=2.12.0 <3.0.0'
flutter: '>=2.0.0'
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0"

dependencies:
async: ^2.6.1
async: ^2.8.2
collection: ^1.15.0
flutter:
sdk: flutter
Expand All @@ -24,9 +24,9 @@ dependencies:
vector_math: ^2.1.0

dev_dependencies:
flutter_lints: ^1.0.4
flutter_lints: ">=1.0.4"
flutter_test:
sdk: flutter
location: ^4.1.1
mockito: ^5.0.2
test: ^1.16.8
test: ^1.16.8