uninav/lib/main.dart

55 lines
1.5 KiB
Dart
Raw Normal View History

2024-04-19 18:07:54 +00:00
import 'package:flutter/material.dart';
2024-04-21 06:24:50 +00:00
import 'package:flutter/services.dart';
2024-04-20 14:32:01 +00:00
import 'package:get/get.dart';
import 'package:uninav/controllers/map_controller.dart';
2024-04-21 14:27:48 +00:00
import 'package:uninav/controllers/navigation_controller.dart';
2024-04-21 12:21:31 +00:00
import 'package:uninav/controllers/shared_prefs_controller.dart';
2024-04-19 18:07:54 +00:00
import 'package:uninav/map.dart';
2024-04-20 14:32:01 +00:00
import 'package:uninav/settings.dart';
2024-04-19 18:07:54 +00:00
2024-04-21 00:22:53 +00:00
// TODO: maybe make not async?
2024-04-21 12:21:31 +00:00
void main() {
2024-04-20 14:32:01 +00:00
Get.put(MyMapController());
2024-04-21 12:21:31 +00:00
rootBundle
.loadString('assets/geo/uulm_beta.geojson')
.then((value) => Get.find<MyMapController>().loadGeoJson(value));
2024-04-21 06:24:50 +00:00
2024-04-21 14:27:48 +00:00
Get.put(NavigationController());
2024-04-21 12:21:31 +00:00
Get.putAsync(() async {
final controller = SharedPrefsController();
await controller.initialize();
2024-04-21 00:22:53 +00:00
return controller;
});
2024-04-19 18:07:54 +00:00
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
2024-04-20 22:35:16 +00:00
darkTheme: ThemeData.dark(
useMaterial3: true,
).copyWith(
colorScheme: ColorScheme.fromSeed(
brightness: Brightness.dark,
seedColor: Colors.deepPurple,
),
),
2024-04-20 14:32:01 +00:00
initialRoute: '/map',
getPages: [
2024-04-21 14:27:48 +00:00
GetPage(name: '/map', page: () => MapPage()),
2024-04-20 14:32:01 +00:00
GetPage(name: '/settings', page: () => const SettingsPage()),
],
2024-04-19 18:07:54 +00:00
);
}
}