flutter_ymap 1.0.0 flutter_ymap: ^1.0.0 copied to clipboard
YMap.
import 'package:example/YMapAPIPage.dart';
import 'package:example/YMapNaviPage.dart';
import 'package:example/YMapPage.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_ymap/YMap.dart';
void main() {
runApp(const MyApp());
YMapSDK.init("");
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'YMap Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'YMap Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: ListView(
children: [
ElevatedButton(
child: Text("地图组件"),
onPressed: () {
Navigator.push(context, CupertinoPageRoute(builder: (context) => YMapPage()));
},
),
ElevatedButton(
child: Text("导航组件"),
onPressed: () {
Navigator.push(context, CupertinoPageRoute(builder: (context) => YMapNaviPage()));
},
),
ElevatedButton(
child: Text("地图API"),
onPressed: () {
Navigator.push(context, CupertinoPageRoute(builder: (context) => YMapAPIPage()));
},
),
],
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}