import 'package:flutter/material.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:shlink_app/LoginView.dart'; import 'package:shlink_app/NavigationBarView.dart'; import 'globals.dart' as globals; void main() { 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 MaterialApp( title: 'Flutter Demo', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blue, brightness: Brightness.light, useMaterial3: true ), darkTheme: ThemeData( primarySwatch: Colors.blue, brightness: Brightness.dark, useMaterial3: true, colorScheme: ColorScheme.dark( background: Colors.black, surface: Color(0xff0d0d0d), secondaryContainer: Colors.grey[300] ) ), themeMode: ThemeMode.system, home: const InitialPage(), ); } } class InitialPage extends StatefulWidget { const InitialPage({super.key}); @override State createState() => _InitialPageState(); } class _InitialPageState extends State { @override void initState() { super.initState(); checkLogin(); } void checkLogin() async { bool result = await globals.serverManager.checkLogin(); if (result) { Navigator.of(context).pushReplacement( MaterialPageRoute(builder: (context) => const NavigationBarView()) ); } else { Navigator.of(context).pushReplacement( MaterialPageRoute(builder: (context) => const LoginView()) ); } } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Text("") ), ); } }