Skip to content
Open
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
4 changes: 4 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutter": "3.32.1",
"flavors": {}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ build/
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3

# FVM
.fvm/
.fvm/flutter_sdk/
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "example",
"cwd": "example",
"request": "launch",
"type": "dart"
},
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dart.flutterSdkPath": ".fvm/versions/3.32.1"
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 1.0.0
- Upgraded for flutter 3 linting rules
- Updated to `google_maps_flutter_platform_interface: ^2.8.0` changes that, Deprecate `BitmapDescriptor.fromBytes` in favor of `BitmapDescriptor.bytes` and `BytesMapBitmap`
- Removes invalid tags in pubspec.
- Upgrade minimum flutter version to 3.16.0
- Upgrade minimum dart version to 3.0.0
- Breaking change use of new method `BitmapDescriptor.bytes` unifies marker size across platforms web, android and ios, and previous work arounds that used the `devicePixelRatio` are no longer needed and in turn will make the markers too big.
- Added new `GoogleMap` props to be available from the `WidgetMarkerGoogleMap` widget.
- Changed `markers` and `widgetMarkers` from a `Set` to a `Map`
- Added a 500ms delay to the `MarkerGenerator` to allow the widgets to use loaded images of any kind.


## 0.0.2
- Added missing arguments
- Upgrade flutter version to 2.10.3
Expand Down
126 changes: 81 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,101 @@ Google map with widget markers.
## Set up
Follow the steps on [google_maps_flutter document.](https://pub.dev/packages/google_maps_flutter#getting-started)

## Usage

Same as google_maps_flutter except for `widgetMarkers`.
## Migrating to 1.0

The update to the `google_maps_flutter_platform_interface: ^2.8.0` changes that, Deprecate`BitmapDescriptor.fromBytes` in favor of `BitmapDescriptor.bytes` that handles it in a `BytesMapBitmap`.

Declaring a multiplatform marker

```dart
WidgetMarkerGoogleMap(
initialCameraPosition: shibuya,
mapType: MapType.normal,
widgetMarkers: [
WidgetMarker(
position: cafePosition,
markerId: 'cafe',
widget: Container(
color: Colors.brown,
padding: const EdgeInsets.all(2),
child: const Icon(
Icons.coffee,
color: Colors.white,
size: 64,
),
WidgetMarker(
position: cafePosition,
markerId: 'cafe',
widget: Container(
color: Colors.brown,
padding: const EdgeInsets.all(2),
child: Icon(
Icons.coffee,
color: Colors.white,
size: 14 * MarkerGenerator.getDevicePixelRatio(context),
),
),
)
```

### 1.0 Usage and Breaking changes

Changed `markers` and `widgetMarkers` from a `Set` to a `Map`
This code can be seen in the example below.

```dart
WidgetMarkerGoogleMap(
initialCameraPosition: shibuya,
mapType: MapType.normal,
markers: {
const MarkerId('default_marker'): Marker(
position: shibuya.target,
markerId: const MarkerId('default_marker'),
),
},
widgetMarkers: <MarkerId, WidgetMarker>{
const MarkerId(
'cafe',
): WidgetMarker(
position: cafePosition,
markerId: 'cafe',
widget: Container(
color: Colors.brown,
padding: const EdgeInsets.all(2),
child: Icon(
Icons.coffee,
color: Colors.white,
size: 14 * MarkerGenerator.getDevicePixelRatio(context),
),
),
WidgetMarker(
position: clothesShopPosition,
markerId: 'clothes',
widget: Container(
color: Colors.green,
padding: const EdgeInsets.all(4),
child: const Text(
'shop',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 32,
),
),
const MarkerId(
'clothes',
): WidgetMarker(
position: clothesShopPosition,
markerId: 'clothes',
widget: Container(
color: Colors.green,
padding: const EdgeInsets.all(4),
child: Text(
'shop',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 10 * MarkerGenerator.getDevicePixelRatio(context),
),
),
),
WidgetMarker(
position: hamburgerShopPosition,
markerId: 'hamburger',
widget: Container(
color: Colors.red,
padding: const EdgeInsets.all(2),
child: const Icon(
Icons.fastfood,
color: Colors.yellow,
size: 64,
),
),
const MarkerId(
'network_flutterlogo',
): WidgetMarker(
position: flutterLogoPosition,
markerId: 'network_flutterlogo',
widget: SizedBox(
width: 18 * MarkerGenerator.getDevicePixelRatio(context),
height: 18 * MarkerGenerator.getDevicePixelRatio(context),
child: Image.network(
'https://storage.googleapis.com/cms-storage-bucket/0dbfcc7a59cd1cf16282.png',
),
),
],
),
),
},
)
```

### WidgetMarker

You need to insert the list of `WidgetMarker` to use widget markers.

Make sure that you still need to use `onTap` method when you use gestures.

```widget_marker.dart
```dart
class WidgetMarker {
WidgetMarker({
required this.position,
Expand All @@ -97,6 +130,8 @@ class WidgetMarker {

If you have any requests or questions, feel free to ask on [github](https://github.com/santa112358/widget_marker_google_map/issues).



## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand All @@ -109,6 +144,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/davey06"><img src="https://avatars.githubusercontent.com/u/32833275?v=4?s=100" width="100px;" alt="Devin"/><br /><sub><b>Devin</b></sub></a><br /><a href="https://github.com/santa112358/widget_marker_google_map/commits?author=davey06" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://pub.dev/publishers/3tadev.work/packages"><img src="https://avatars.githubusercontent.com/u/43510799?v=4?s=100" width="100px;" alt="Santa Takahashi"/><br /><sub><b>Santa Takahashi</b></sub></a><br /><a href="https://github.com/santa112358/widget_marker_google_map/commits?author=santa112358" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/LuisReyes98"><img src="https://avatars.githubusercontent.com/u/26679961?v=4?s=100" width="100px;" alt="Devin"/><br /><sub><b>Luis Rogelio</b></sub></a><br /><a href="https://github.com/santa112358/widget_marker_google_map/commits?author=LuisReyes98" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
4 changes: 4 additions & 0 deletions example/.fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutter": "3.27.3",
"flavors": {}
}
5 changes: 4 additions & 1 deletion example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
/android/app/src/main/AndroidManifest.xml
/android/app/src/main/AndroidManifest.xml

# FVM Version Cache
.fvm/
24 changes: 22 additions & 2 deletions example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@
# This file should be version controlled and should not be manually edited.

version:
revision: 3595343e20a61ff16d14e8ecc25f364276bb1b8b
channel: stable
revision: "c519ee916eaeb88923e67befb89c0f1dabfa83e6"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: c519ee916eaeb88923e67befb89c0f1dabfa83e6
base_revision: c519ee916eaeb88923e67befb89c0f1dabfa83e6
- platform: web
create_revision: c519ee916eaeb88923e67befb89c0f1dabfa83e6
base_revision: c519ee916eaeb88923e67befb89c0f1dabfa83e6

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
2 changes: 1 addition & 1 deletion example/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gradle-wrapper.jar
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
64 changes: 20 additions & 44 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,68 +1,44 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30
namespace = "com.example.example"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 20
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
applicationId = "com.example.example"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = 20
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig = signingConfigs.debug
}
}
}

flutter {
source '../..'
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
source = "../.."
}
6 changes: 3 additions & 3 deletions example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example">
<!-- Flutter needs it to communicate with the running application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
Loading