Skip to content

Commit 3a272e1

Browse files
committed
[taichi_web_map] initial
1 parent 79ae8ef commit 3a272e1

26 files changed

+1480
-0
lines changed

taichi_web_map/.gitignore

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
50+
key.txt
51+
52+
assets/

taichi_web_map/.metadata

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled.
5+
6+
version:
7+
revision: 85684f9300908116a78138ea4c6036c35c9a1236
8+
channel: stable
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
17+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
18+
- platform: android
19+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
20+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
21+
- platform: ios
22+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
23+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
24+
- platform: linux
25+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
26+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
27+
- platform: macos
28+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
29+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
30+
- platform: web
31+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
32+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
33+
- platform: windows
34+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
35+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

taichi_web_map/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# taichi_web_map_plugin
2+
3+
## 改版后的高德地图web js api,调用之前需要添加自己的安全密钥到html文件中
4+
```html
5+
<script type="text/javascript">
6+
window._AMapSecurityConfig = {
7+
securityJsCode:'your secret key',
8+
}
9+
</script>
10+
<script src="https://webapi.amap.com/loader.js"></script>
11+
<script src="main.dart.js" type="application/javascript"></script>
12+
```

taichi_web_map/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

taichi_web_map/example/.gitignore

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
assets/

taichi_web_map/example/.metadata

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled.
5+
6+
version:
7+
revision: 85684f9300908116a78138ea4c6036c35c9a1236
8+
channel: stable
9+
10+
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
17+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
18+
- platform: android
19+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
20+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
21+
- platform: ios
22+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
23+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
24+
- platform: linux
25+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
26+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
27+
- platform: macos
28+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
29+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
30+
- platform: web
31+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
32+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
33+
- platform: windows
34+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
35+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

taichi_web_map/example/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# taichi_web_map_example
2+
3+
A new Flutter project.
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.
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

taichi_web_map/example/lib/main.dart

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// ignore_for_file: prefer_typing_uninitialized_variables
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:flutter/services.dart';
5+
import 'package:taichi_web_map/amap_web_controller.dart';
6+
import 'package:taichi_web_map/map_view.dart';
7+
8+
void main() {
9+
runApp(const MyApp());
10+
}
11+
12+
class MyApp extends StatelessWidget {
13+
const MyApp({Key? key}) : super(key: key);
14+
15+
@override
16+
Widget build(BuildContext context) {
17+
return const MaterialApp(
18+
debugShowCheckedModeBanner: false,
19+
home: Home(),
20+
);
21+
}
22+
}
23+
24+
class Home extends StatefulWidget {
25+
const Home({Key? key}) : super(key: key);
26+
27+
@override
28+
State<Home> createState() => _HomeState();
29+
}
30+
31+
class _HomeState extends State<Home> {
32+
var loadKey;
33+
late String data;
34+
late final AmapWebController controller;
35+
@override
36+
void initState() {
37+
super.initState();
38+
loadKey = loadKeyFuture();
39+
}
40+
41+
loadKeyFuture() async {
42+
data = await rootBundle.loadString("assets/key.txt");
43+
}
44+
45+
@override
46+
Widget build(BuildContext context) {
47+
return Scaffold(
48+
body: Column(
49+
children: [
50+
const Text("map"),
51+
SizedBox(
52+
height: 300,
53+
width: 500,
54+
child: FutureBuilder(
55+
future: loadKey,
56+
builder: (c, s) {
57+
if (s.connectionState == ConnectionState.done) {
58+
debugPrint("data:$data");
59+
return TaichiMapView(
60+
apiKey: data,
61+
onCreate: (c) {
62+
controller = c;
63+
},
64+
onPoiSearched: (r) {
65+
debugPrint("r:${r.toString()}");
66+
},
67+
);
68+
}
69+
return const CircularProgressIndicator();
70+
},
71+
),
72+
)
73+
],
74+
),
75+
);
76+
}
77+
}

0 commit comments

Comments
 (0)