2024-08-05 08:00:16 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2024-08-20 10:00:10 +01:00
|
|
|
import 'package:flutter_map/flutter_map.dart';
|
2024-08-21 11:49:38 +01:00
|
|
|
import 'package:latlong2/latlong.dart';
|
2024-08-21 14:37:44 +01:00
|
|
|
import 'package:mobile/favourites.dart';
|
2024-08-20 15:46:13 +01:00
|
|
|
import 'package:mobile/register.dart';
|
2024-08-21 11:49:38 +01:00
|
|
|
import 'login.dart';
|
2024-08-21 12:28:48 +01:00
|
|
|
import 'base/sidemenu.dart';
|
|
|
|
import 'profile.dart';
|
2024-08-05 08:00:16 +01:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
|
|
|
title: 'H4 Flutter',
|
|
|
|
theme: ThemeData(
|
2024-08-20 13:04:40 +01:00
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
|
2024-08-05 08:00:16 +01:00
|
|
|
useMaterial3: true,
|
|
|
|
),
|
2024-08-21 14:37:44 +01:00
|
|
|
home: const MyHomePage(),
|
2024-08-21 12:28:48 +01:00
|
|
|
initialRoute: '/',
|
|
|
|
routes: {
|
2024-08-21 14:37:44 +01:00
|
|
|
'/home': (context) => const MyHomePage(),
|
2024-08-21 12:28:48 +01:00
|
|
|
'/profile': (context) => const ProfilePage(),
|
2024-08-21 14:37:44 +01:00
|
|
|
'/favourites': (context) => const FavouritesPage(),
|
|
|
|
'/login': (context) => const LoginPage(),
|
|
|
|
'/register': (context) => const RegisterPage(),
|
2024-08-21 12:28:48 +01:00
|
|
|
},
|
2024-08-05 08:00:16 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyHomePage extends StatefulWidget {
|
2024-08-21 14:37:44 +01:00
|
|
|
const MyHomePage({super.key});
|
2024-08-05 08:00:16 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
2024-08-21 11:49:38 +01:00
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
2024-08-05 08:00:16 +01:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-08-21 12:28:48 +01:00
|
|
|
return SideMenu(
|
|
|
|
body: Scaffold(
|
2024-08-21 13:24:53 +01:00
|
|
|
key: _scaffoldKey,
|
2024-08-21 14:37:44 +01:00
|
|
|
//drawer: navigationMenu,
|
|
|
|
body: FlutterMap(
|
|
|
|
options: const MapOptions(
|
|
|
|
initialCenter: LatLng(55.9397, 9.5156), initialZoom: 7.0),
|
|
|
|
children: [
|
2024-08-21 12:28:48 +01:00
|
|
|
openStreetMapTileLayer,
|
|
|
|
const MarkerLayer(markers: [
|
|
|
|
Marker(
|
|
|
|
point: LatLng(56.465511, 9.411366),
|
|
|
|
width: 60,
|
|
|
|
height: 100,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Icon(
|
|
|
|
Icons.location_pin,
|
|
|
|
size: 60,
|
|
|
|
color: Colors.purple,
|
|
|
|
),
|
2024-08-20 15:46:13 +01:00
|
|
|
),
|
2024-08-21 12:28:48 +01:00
|
|
|
]),
|
2024-08-21 14:37:44 +01:00
|
|
|
],
|
|
|
|
),
|
2024-08-21 12:28:48 +01:00
|
|
|
),
|
2024-08-05 08:00:16 +01:00
|
|
|
);
|
|
|
|
}
|
2024-08-20 15:46:13 +01:00
|
|
|
|
2024-08-21 12:28:48 +01:00
|
|
|
TileLayer get openStreetMapTileLayer => TileLayer(
|
2024-08-21 14:37:44 +01:00
|
|
|
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
|
|
userAgentPackageName: 'dev.fleaflet.flutter_map.example',
|
|
|
|
);
|
2024-08-05 08:00:16 +01:00
|
|
|
}
|