naver_map_plugin 0.8.2 naver_map_plugin: ^0.8.2 copied to clipboard
Android환경과 ios환경에서 네이버지도를 표시하는 프로젝트입니다. flutter naver map plugin support android and iOS. and this plugin stil has lots of problem.
import 'package:flutter/material.dart';
import 'package:naver_map_plugin_example/base_map.dart';
import 'package:naver_map_plugin_example/circle_map.dart';
import 'package:naver_map_plugin_example/marker_map_page.dart';
import 'package:naver_map_plugin_example/path_map.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MainPage(),
);
}
}
class MainPage extends StatefulWidget {
@override
_MainPageState createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
List<String> menuText = [
'기본 지도 예제',
'마커 예제',
'패스 예제',
'원형 오버레이 예제',
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
padding: EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: menuText.map((text) => GestureDetector(
onTap: () => _onTapMenuItem(text),
child: Container(
margin: EdgeInsets.symmetric(vertical: 8),
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
border: Border.all(color: Colors.indigo),
),
child: Text(
text,
style: TextStyle(
color: Colors.indigo,
fontSize: 12,
fontWeight: FontWeight.w600,
),
textAlign: TextAlign.center,
),
),
)).toList(),
),
),
);
}
_onTapMenuItem(String text) {
final index = menuText.indexOf(text);
switch(index){
case 0:
Navigator.push(context, MaterialPageRoute(
builder: (context) => BaseMapPage(),
));
break;
case 1:
Navigator.push(context, MaterialPageRoute(
builder: (context) => MarkerMapPage(),
));
break;
case 2:
Navigator.push(context, MaterialPageRoute(
builder: (context) => PathMapPage(),
));
break;
case 3:
Navigator.push(context, MaterialPageRoute(
builder: (context) => CircleMapPage(),
));
break;
}
}
}