Skip to content

Commit

Permalink
Add flutter_lints and apply all suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Rene Floor <rene.floor@ah.nl>
  • Loading branch information
renefloor committed Feb 23, 2024
1 parent 0f1b0a3 commit c1da3f9
Show file tree
Hide file tree
Showing 25 changed files with 356 additions and 441 deletions.
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include: package:flutter_lints/flutter.yaml

2 changes: 2 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include: package:flutter_lints/flutter.yaml

2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
28 changes: 14 additions & 14 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ PODS:
- apple_maps_flutter (0.0.1):
- Flutter
- Flutter (1.0.0)
- google_maps_flutter (0.0.1):
- google_maps_flutter_ios (0.0.1):
- Flutter
- GoogleMaps (< 3.10)
- GoogleMaps (3.9.0):
- GoogleMaps/Maps (= 3.9.0)
- GoogleMaps/Base (3.9.0)
- GoogleMaps/Maps (3.9.0):
- GoogleMaps (< 9.0)
- GoogleMaps (6.2.1):
- GoogleMaps/Maps (= 6.2.1)
- GoogleMaps/Base (6.2.1)
- GoogleMaps/Maps (6.2.1):
- GoogleMaps/Base

DEPENDENCIES:
- apple_maps_flutter (from `.symlinks/plugins/apple_maps_flutter/ios`)
- Flutter (from `Flutter`)
- google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)

SPEC REPOS:
trunk:
Expand All @@ -25,15 +25,15 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/apple_maps_flutter/ios"
Flutter:
:path: Flutter
google_maps_flutter:
:path: ".symlinks/plugins/google_maps_flutter/ios"
google_maps_flutter_ios:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"

SPEC CHECKSUMS:
apple_maps_flutter: c59725efea39e13e703cde52a1d2b14866ad68a8
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619
GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
google_maps_flutter_ios: f135b968a67c05679e0a53538e900b5c174b0d99
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

COCOAPODS: 1.10.1
COCOAPODS: 1.15.0
13 changes: 8 additions & 5 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -157,7 +157,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -201,10 +201,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down Expand Up @@ -271,6 +273,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -358,7 +361,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -432,7 +435,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -481,7 +484,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 4 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
50 changes: 25 additions & 25 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
import 'package:flutter/material.dart';
import 'package:platform_maps_flutter/platform_maps_flutter.dart';

void main() => runApp(MyApp());
void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
return const MaterialApp(
home: MyHomePage(),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key? key}) : super(key: key);
const MyHomePage({Key? key}) : super(key: key);

@override
_MyHomePageState createState() => _MyHomePageState();
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: PlatformMap(
initialCameraPosition: CameraPosition(
target: const LatLng(47.6, 8.8796),
initialCameraPosition: const CameraPosition(
target: LatLng(47.6, 8.8796),
zoom: 16.0,
),
markers: Set<Marker>.of(
[
Marker(
markerId: MarkerId('marker_1'),
position: LatLng(47.6, 8.8796),
consumeTapEvents: true,
infoWindow: InfoWindow(
title: 'PlatformMarker',
snippet: "Hi I'm a Platform Marker",
),
onTap: () {
print("Marker tapped");
},
markers: <Marker>{
Marker(
markerId: const MarkerId('marker_1'),
position: const LatLng(47.6, 8.8796),
consumeTapEvents: true,
infoWindow: const InfoWindow(
title: 'PlatformMarker',
snippet: "Hi I'm a Platform Marker",
),
],
),
onTap: () {
debugPrint("Marker tapped");
},
),
},
mapType: MapType.satellite,
onTap: (location) => print('onTap: $location'),
onCameraMove: (cameraUpdate) => print('onCameraMove: $cameraUpdate'),
onTap: (location) => debugPrint('onTap: $location'),
onCameraMove: (cameraUpdate) => debugPrint('onCameraMove: $cameraUpdate'),
compassEnabled: true,
onMapCreated: (controller) {
Future.delayed(Duration(seconds: 2)).then(
Future.delayed(const Duration(seconds: 2)).then(
(_) {
controller.animateCamera(
CameraUpdate.newCameraPosition(
Expand All @@ -64,7 +64,7 @@ class _MyHomePageState extends State<MyHomePage> {
);
controller
.getVisibleRegion()
.then((bounds) => print("bounds: ${bounds.toString()}"));
.then((bounds) => debugPrint("bounds: ${bounds.toString()}"));
},
);
},
Expand Down
58 changes: 2 additions & 56 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
name: flutter_platform_maps_example

# 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
publish_to: 'none'
version: 1.0.0+1

environment:
Expand All @@ -26,52 +12,12 @@ dependencies:
platform_maps_flutter:
path: ../

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2

dev_dependencies:
flutter_lints: ^3.0.1
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:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

# 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: 2 additions & 4 deletions lib/platform_maps_flutter.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
library platform_maps_flutter;

import 'dart:io';
import 'dart:typed_data';

import 'package:apple_maps_flutter/apple_maps_flutter.dart' as appleMaps;
import 'package:flutter/cupertino.dart';
import 'package:apple_maps_flutter/apple_maps_flutter.dart' as apple_maps;
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart' as googleMaps;
import 'package:google_maps_flutter/google_maps_flutter.dart' as google_maps;
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';

part 'src/bitmap.dart';
Expand Down
14 changes: 7 additions & 7 deletions lib/src/bitmap.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of platform_maps_flutter;
part of '../platform_maps_flutter.dart';

/// Defines a bitmap image. For a marker, this class can be used to set the
/// image of the marker icon. For a ground overlay, it can be used to set the
Expand All @@ -12,9 +12,9 @@ class BitmapDescriptor {
/// Creates a BitmapDescriptor that refers to the default marker image.
static BitmapDescriptor? get defaultMarker {
if (Platform.isIOS) {
return BitmapDescriptor._(appleMaps.BitmapDescriptor.defaultAnnotation);
return BitmapDescriptor._(apple_maps.BitmapDescriptor.defaultAnnotation);
} else if (Platform.isAndroid) {
return BitmapDescriptor._(googleMaps.BitmapDescriptor.defaultMarker);
return BitmapDescriptor._(google_maps.BitmapDescriptor.defaultMarker);
}
return null;
}
Expand All @@ -33,14 +33,14 @@ class BitmapDescriptor {
}) async {
dynamic bitmap;
if (Platform.isIOS) {
bitmap = await appleMaps.BitmapDescriptor.fromAssetImage(
bitmap = await apple_maps.BitmapDescriptor.fromAssetImage(
configuration,
assetName,
bundle: bundle,
package: package,
);
} else if (Platform.isAndroid) {
bitmap = await googleMaps.BitmapDescriptor.fromAssetImage(
bitmap = await google_maps.BitmapDescriptor.fromAssetImage(
configuration,
assetName,
bundle: bundle,
Expand All @@ -54,8 +54,8 @@ class BitmapDescriptor {
/// as PNG.
static BitmapDescriptor fromBytes(Uint8List byteData) {
var bitmap = Platform.isAndroid
? googleMaps.BitmapDescriptor.fromBytes(byteData)
: appleMaps.BitmapDescriptor.fromBytes(byteData);
? google_maps.BitmapDescriptor.fromBytes(byteData)
: apple_maps.BitmapDescriptor.fromBytes(byteData);
return BitmapDescriptor._(bitmap);
}
}
Loading

0 comments on commit c1da3f9

Please sign in to comment.