/
main.dart
48 lines (41 loc) · 1.29 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import 'package:flutter/material.dart';
import 'package:map_launcher_example/show_directions.dart';
import 'package:map_launcher_example/show_marker.dart';
void main() => runApp(const MapLauncherDemo());
class MapLauncherDemo extends StatefulWidget {
const MapLauncherDemo({super.key});
@override
State<MapLauncherDemo> createState() => _MapLauncherDemoState();
}
enum LaunchMode { marker, directions }
class _MapLauncherDemoState extends State<MapLauncherDemo> {
int selectedTabIndex = 0;
List<Widget> widgets = [const ShowMarker(), const ShowDirections()];
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Map Launcher Demo'),
),
body: widgets[selectedTabIndex],
bottomNavigationBar: BottomNavigationBar(
currentIndex: selectedTabIndex,
onTap: (newTabIndex) => setState(() {
selectedTabIndex = newTabIndex;
}),
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.pin_drop),
label: 'Marker',
),
BottomNavigationBarItem(
icon: Icon(Icons.directions),
label: 'Directions',
),
],
),
),
);
}
}