feat: app Flutter GameManager (OIDC pocket-id, contrôle serveurs, MOTD live, auto-update) + CI APK signée
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2c5476b1db
commit
3286640b37
@@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'screens/login_screen.dart';
|
||||
import 'screens/servers_screen.dart';
|
||||
import 'services/api_service.dart';
|
||||
import 'services/auth_service.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
void main() => runApp(const GameManagerApp());
|
||||
|
||||
class GameManagerApp extends StatelessWidget {
|
||||
const GameManagerApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final auth = AuthService();
|
||||
final api = ApiService(auth);
|
||||
return MaterialApp(
|
||||
title: 'GameManager',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.light(),
|
||||
darkTheme: AppTheme.dark(),
|
||||
themeMode: ThemeMode.system,
|
||||
home: AuthGate(auth: auth, api: api),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Aiguille vers la connexion ou la liste des serveurs selon l'état d'auth.
|
||||
class AuthGate extends StatefulWidget {
|
||||
const AuthGate({super.key, required this.auth, required this.api});
|
||||
final AuthService auth;
|
||||
final ApiService api;
|
||||
|
||||
@override
|
||||
State<AuthGate> createState() => _AuthGateState();
|
||||
}
|
||||
|
||||
class _AuthGateState extends State<AuthGate> {
|
||||
bool? _loggedIn;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.auth.isLoggedIn().then((v) => setState(() => _loggedIn = v));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_loggedIn == null) {
|
||||
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
||||
}
|
||||
if (_loggedIn!) {
|
||||
return ServersScreen(
|
||||
auth: widget.auth,
|
||||
api: widget.api,
|
||||
onLoggedOut: () => setState(() => _loggedIn = false),
|
||||
);
|
||||
}
|
||||
return LoginScreen(
|
||||
auth: widget.auth,
|
||||
onLoggedIn: () => setState(() => _loggedIn = true),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user