This commit is contained in:
zoe 2022-07-02 00:41:37 +02:00
parent d0f02d1ad6
commit 061e12b285

View file

@ -3,11 +3,18 @@ import 'package:intl/intl.dart';
import 'package:localization/localization.dart'; import 'package:localization/localization.dart';
import 'package:slothmu/partials/main_scaffold.dart'; import 'package:slothmu/partials/main_scaffold.dart';
import 'pages/login.dart'; import 'pages/login.dart';
import 'business_logic/settings.dart' as settings;
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
void main() { String initRoute = "/";
void main() async {
Intl.defaultLocale = 'en_US'; Intl.defaultLocale = 'en_US';
// check if all information is available
if (await settings.loadAuthCode() == "") {
initRoute = "/login";
}
runApp(const Slothmu()); runApp(const Slothmu());
} }
@ -34,7 +41,7 @@ class _SlothmuState extends State<Slothmu> {
GlobalMaterialLocalizations.delegate, GlobalMaterialLocalizations.delegate,
LocalJsonLocalization.delegate, LocalJsonLocalization.delegate,
], ],
initialRoute: '/login', initialRoute: initRoute,
routes: { routes: {
'/': (context) => const MainScaffold(), '/': (context) => const MainScaffold(),
'/login': (context) => const Login(), '/login': (context) => const Login(),