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
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ mason-lock.json

*.flutter-plugins-dependencies
*.flutter-plugins
*.env
1 change: 1 addition & 0 deletions examples/mirai_gallery/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply from: project(':flutter_config').projectDir.getPath() + "/dotenv.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,11 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />

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

</application>
</manifest>
25 changes: 24 additions & 1 deletion examples/mirai_gallery/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
PODS:
- Flutter (1.0.0)
- flutter_config (0.0.1):
- Flutter
- google_maps_flutter_ios (0.0.1):
- Flutter
- GoogleMaps (< 9.0)
- GoogleMaps (6.2.1):
- GoogleMaps/Maps (= 6.2.1)
- GoogleMaps/Base (6.2.1)
- GoogleMaps/Maps (6.2.1):
- GoogleMaps/Base
- webview_flutter_wkwebview (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_config (from `.symlinks/plugins/flutter_config/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
trunk:
- GoogleMaps

EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_config:
:path: ".symlinks/plugins/flutter_config/ios"
google_maps_flutter_ios:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_config: f48f0d47a284f1791aacce2687eabb3309ba7a41
google_maps_flutter_ios: f135b968a67c05679e0a53538e900b5c174b0d99
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796

COCOAPODS: 1.15.2
COCOAPODS: 1.13.0
18 changes: 18 additions & 0 deletions examples/mirai_gallery/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
9182110C26875E7D26526D19 /* [CP] Embed Pods Frameworks */,
5D9698FE94B37C1FBA620C82 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -285,6 +286,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
5D9698FE94B37C1FBA620C82 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
83A1AC20750C3F0F0F56EB86 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
8 changes: 8 additions & 0 deletions examples/mirai_gallery/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
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)
}
Expand Down
49 changes: 49 additions & 0 deletions examples/mirai_gallery/lib/app/google_map/google_map_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:mirai/mirai.dart';

class GoogleMapScreen extends StatelessWidget {
const GoogleMapScreen({super.key});

@override
Widget build(BuildContext context) {
// log("data ${data.toJson()}");



return Mirai.fromJson({
"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,
}
}
}, context) ??
const SizedBox();
}
}
15 changes: 11 additions & 4 deletions examples/mirai_gallery/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_config/flutter_config.dart';
import 'package:mirai/mirai.dart';
import 'package:mirai_gallery/app/details/details_screen.dart';
import 'package:mirai_gallery/app/example/example_screen_parser.dart';
import 'package:mirai_gallery/app/home/home_screen.dart';
import 'package:mirai_gallery/app_theme/app_theme_cubit.dart';
import 'package:mirai_webview/mirai_webview.dart';

import 'app/google_map/google_map_screen.dart';

class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
..badCertificateCallback = (X509Certificate cert, String host, int port) => true;
}
}

void main() async {
WidgetsFlutterBinding.ensureInitialized(); // Required by FlutterConfig
await FlutterConfig.loadEnvVariables();

HttpOverrides.global = MyHttpOverrides();
await Mirai.initialize(
parsers: const [
Expand All @@ -43,10 +48,12 @@ class MyApp extends StatelessWidget {
theme: state.lightTheme,
darkTheme: state.darkTheme,
themeMode: state.themeMode,
homeBuilder: (context) => const HomeScreen(),
// homeBuilder: (context) => const HomeScreen(),
homeBuilder: (context) => const GoogleMapScreen(),
title: 'Mirai Gallery',
routes: {
'/homeScreen': (context) => const HomeScreen(),
// '/homeScreen': (context) => const HomeScreen(),
'/homeScreen': (context) => const GoogleMapScreen(),
'/detailsScreen': (context) => const DetailsScreen(),
},
);
Expand Down
Loading
Loading