Skip to content

Commit cabfeed

Browse files
committed
Init
0 parents  commit cabfeed

20 files changed

+521
-0
lines changed

.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
.packages
30+
build/
31+
32+
.metadata
33+
pubspec.lock

CHANGELOG.md

Whitespace-only changes.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 7c00 <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# tencent_map
2+
3+
A new Flutter plugin project.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter
8+
[plug-in package](https://flutter.dev/developing-packages/),
9+
a specialized package that includes platform-specific implementation code for
10+
Android and/or iOS.
11+
12+
For help getting started with Flutter development, view the
13+
[online documentation](https://flutter.dev/docs), which offers tutorials,
14+
samples, guidance on mobile development, and a full API reference.
15+

analysis_options.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
# Additional information about this file can be found at
4+
# https://dart.dev/guides/language/analysis-options

android/.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.cxx

android/build.gradle

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
group 'qiuxiang.tencent_map'
2+
version '1.0-SNAPSHOT'
3+
4+
buildscript {
5+
ext.kotlin_version = '1.6.10'
6+
repositories {
7+
google()
8+
mavenCentral()
9+
}
10+
11+
dependencies {
12+
classpath 'com.android.tools.build:gradle:7.1.2'
13+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14+
}
15+
}
16+
17+
rootProject.allprojects {
18+
repositories {
19+
google()
20+
mavenCentral()
21+
}
22+
}
23+
24+
apply plugin: 'com.android.library'
25+
apply plugin: 'kotlin-android'
26+
27+
android {
28+
compileSdkVersion 31
29+
30+
compileOptions {
31+
sourceCompatibility JavaVersion.VERSION_1_8
32+
targetCompatibility JavaVersion.VERSION_1_8
33+
}
34+
35+
kotlinOptions {
36+
jvmTarget = '1.8'
37+
}
38+
39+
sourceSets {
40+
main.java.srcDirs += 'src/main/kotlin'
41+
}
42+
43+
defaultConfig {
44+
minSdkVersion 16
45+
}
46+
}
47+
48+
dependencies {
49+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
50+
implementation 'com.tencent.map:tencent-map-vector-sdk:4.5.6'
51+
}

android/settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'tencent_map'

android/src/main/AndroidManifest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="qiuxiang.tencent_map">
3+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package qiuxiang.tencent_map
2+
3+
import android.content.Context
4+
import android.view.View
5+
import com.tencent.tencentmap.mapsdk.maps.MapView
6+
import io.flutter.plugin.platform.PlatformView
7+
8+
class TencentMap(context: Context?, viewId: Int, args: Any?) : PlatformView {
9+
private val view = MapView(context!!)
10+
11+
override fun getView(): View {
12+
return view
13+
}
14+
15+
override fun dispose() {}
16+
17+
init {
18+
view.onResume()
19+
view.map.uiSettings.isRotateGesturesEnabled = false
20+
view.map.uiSettings.isTiltGesturesEnabled = false
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package qiuxiang.tencent_map
2+
3+
import android.content.Context
4+
import io.flutter.plugin.common.StandardMessageCodec
5+
import io.flutter.plugin.platform.PlatformView
6+
import io.flutter.plugin.platform.PlatformViewFactory
7+
8+
class TencentMapFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) {
9+
override fun create(context: Context?, viewId: Int, args: Any?): PlatformView {
10+
return TencentMap(context, viewId, args)
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package qiuxiang.tencent_map
2+
3+
import androidx.annotation.NonNull
4+
import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer
5+
6+
import io.flutter.embedding.engine.plugins.FlutterPlugin
7+
import io.flutter.plugin.common.MethodCall
8+
import io.flutter.plugin.common.MethodChannel
9+
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
10+
import io.flutter.plugin.common.MethodChannel.Result
11+
12+
/** TencentMapPlugin */
13+
class TencentMapPlugin : FlutterPlugin, MethodCallHandler {
14+
/// The MethodChannel that will the communication between Flutter and native Android
15+
///
16+
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
17+
/// when the Flutter Engine is detached from the Activity
18+
private lateinit var channel: MethodChannel
19+
20+
override fun onAttachedToEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
21+
channel = MethodChannel(binding.binaryMessenger, "tencent_map")
22+
channel.setMethodCallHandler(this)
23+
binding.platformViewRegistry.registerViewFactory("tencent_map", TencentMapFactory())
24+
TencentMapInitializer.setAgreePrivacy(true)
25+
}
26+
27+
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
28+
if (call.method == "getPlatformVersion") {
29+
result.success("Android ${android.os.Build.VERSION.RELEASE}")
30+
} else {
31+
result.notImplemented()
32+
}
33+
}
34+
35+
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
36+
channel.setMethodCallHandler(null)
37+
}
38+
}

example/.gitignore

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
**/doc/api/
26+
**/ios/Flutter/.last_build_id
27+
.dart_tool/
28+
.flutter-plugins
29+
.flutter-plugins-dependencies
30+
.packages
31+
.pub-cache/
32+
.pub/
33+
/build/
34+
35+
# Web related
36+
lib/generated_plugin_registrant.dart
37+
38+
# Symbolication related
39+
app.*.symbols
40+
41+
# Obfuscation related
42+
app.*.map.json
43+
44+
# Android Studio will place build artifacts here
45+
/android/app/debug
46+
/android/app/profile
47+
/android/app/release
48+
49+
android/
50+
ios/

example/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# tencent_map_example
2+
3+
Demonstrates how to use the tencent_map plugin.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter application.
8+
9+
A few resources to get you started if this is your first Flutter project:
10+
11+
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12+
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13+
14+
For help getting started with Flutter development, view the
15+
[online documentation](https://docs.flutter.dev/), which offers tutorials,
16+
samples, guidance on mobile development, and a full API reference.

example/analysis_options.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
24+
rules:
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

example/lib/main.dart

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:tencent_map/tencent_map.dart';
3+
4+
void main() {
5+
runApp(const App());
6+
}
7+
8+
class App extends StatelessWidget {
9+
const App({Key? key}) : super(key: key);
10+
11+
@override
12+
Widget build(BuildContext context) {
13+
return const MaterialApp(
14+
home: Scaffold(
15+
body: Center(child: TencentMap()),
16+
),
17+
);
18+
}
19+
}

0 commit comments

Comments
 (0)