-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
335 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,63 @@ | ||
# ai_amap_example | ||
|
||
Demonstrates how to use the ai_amap plugin. | ||
``` | ||
## Getting Started | ||
import 'dart:async'; | ||
import 'package:ai_amap/ai_amap.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
void main() { | ||
runApp(MyApp()); | ||
} | ||
class MyApp extends StatefulWidget { | ||
@override | ||
_MyAppState createState() => _MyAppState(); | ||
} | ||
class _MyAppState extends State<MyApp> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
initPlatformState(); | ||
} | ||
// Platform messages are asynchronous, so we initialize in an async method. | ||
Future<void> initPlatformState() async { | ||
String platformVersion; | ||
// Platform messages may fail, so we use a try/catch PlatformException. | ||
try { | ||
platformVersion = await AiAMapHelper.platformVersion; | ||
} on PlatformException { | ||
platformVersion = 'Failed to get platform version.'; | ||
} | ||
// If the widget was removed from the tree while the asynchronous platform | ||
// message was in flight, we want to discard the reply rather than calling | ||
// setState to update our non-existent appearance. | ||
if (!mounted) return; | ||
} | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
home: Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Plugin example app'), | ||
), | ||
body: Column( | ||
children: [ | ||
Expanded( | ||
child: AiAMapPlatformWidget(), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} | ||
This project is a starting point for a Flutter application. | ||
A few resources to get you started if this is your first Flutter project: | ||
|
||
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) | ||
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) | ||
|
||
For help getting started with Flutter, view our | ||
[online documentation](https://flutter.dev/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters