52 lines
1.5 KiB
Dart
52 lines
1.5 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:get_storage/get_storage.dart';
|
|
|
|
import '../../utils/http_overrides.dart';
|
|
import '../../pages/home/home_view.dart';
|
|
import '../../utils/sample_routes.dart';
|
|
|
|
void main() async {
|
|
await GetStorage.init();
|
|
HttpOverrides.global = MyHttpOverrides();
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
// This widget is the root of your application.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final boxSettings = GetStorage();
|
|
// Eine Map definieren
|
|
bool isNoSettings = boxSettings.hasData('BASEURL');
|
|
if (isNoSettings == false) {
|
|
_preSetDataInLocalStorage(boxSettings);
|
|
}
|
|
|
|
return GetMaterialApp(
|
|
debugShowCheckedModeBanner: false, // Debug-Banner deaktivieren
|
|
title: 'Kantine Ausgaben',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.grey.shade600),
|
|
),
|
|
initialRoute: HomePage.namedRoute,
|
|
getPages: SampleRouts.samplePages,
|
|
);
|
|
}
|
|
|
|
void _preSetDataInLocalStorage(GetStorage boxSettings) {
|
|
boxSettings.write('BASEURL', 'https://api.notion.com/v1/databases/d036c0bc06304126aedaa8c5ad92b406/query');
|
|
boxSettings.write('TOKEN', 'secret_05Q0wxvdUrJuNC1s1CuEXxO2nxdJFxiPAbWfaDKGWKo');
|
|
Map<String, String> headers = {
|
|
'Notion-Version': '2021-08-16',
|
|
'Content-Type': 'application/json',
|
|
};
|
|
boxSettings.write('HEADERS', headers);
|
|
}
|
|
}
|
|
|