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

Feat: base implementation of google_map feature on framework #288

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

mtellect
Copy link

@mtellect mtellect commented Mar 13, 2024

Description

This PR is intended to kickstart the process of adding a base implementation for google_maps support on framework

Create a .env file at the root of your project and add:

GOOGLE_MAP_KEY_ANDROID=YOUR_ANDROID_KEY
GOOGLE_MAP_KEY_IOS=YOUR_IOS_KEY

On Android Manifest add:

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/GOOGLE_MAP_KEY_ANDROID"
            tools:replace="android:value" />

On iOS AppDelegate.swift add:

import UIKit
import Flutter

import flutter_config
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        
        //[Google map key]
        let googleMapKey = FlutterConfigPlugin.env(for: "GOOGLE_MAP_KEY_IOS")
        GMSServices.provideAPIKey(googleMapKey!)

        GeneratedPluginRegistrant.register(with: self)
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }
}

Json example:

{
  "type": "scaffold",
  "appBar": {
    "type": "appBar",
    "title": {
      "type": "text",
      "data": "Google Map Example"
    }
  },
  "body": {
    "type": "googleMap",
    "initialCameraPosition": {
      "target": {
        "latitude": 37.42796133580664,
        "longitude": -122.085749655962
      },
      "zoom": 14.4746,
      "tilt": 10
    },
    "compassEnabled": true,
    "mapToolbarEnabled": true,
    "indoorViewEnabled": true,
    "trafficEnabled": true,
    "buildingsEnabled": true,
    "myLocationButtonEnabled": true,
    "padding": {
      "left": 50,
      "right": 10,
      "bottom": 20
    }
  }
}

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Code refactor
  • Build configuration change
  • Documentation
  • Chore

@mtellect mtellect changed the title base implementation of google_map feature on framework Feat: base implementation of google_map feature on framework Mar 13, 2024
@divyanshub024
Copy link
Member

Hey @mtellect, Thank you so much for this amazing contribution 🎉. By far this is probably the biggest single contribution. 🥇

I have one request. I don't want to make the main framework bloated. Cab we create a separate package for mirai_google_map in packages folder

@mtellect
Copy link
Author

Hi @divyanshub024 , i'd refactor into packages.

@divyanshub024
Copy link
Member

Hey @mtellect, let me know if you have any questions or need any help. :)

@mtellect
Copy link
Author

mtellect commented Apr 3, 2024

Hi @divyanshub024 i'd make updates soon as i get some bandwidth. cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants