Build APK / build (push) Successful in 2m49s
- backend: GET /api/containers (liste lisible), POST/DELETE /api/servers (serveurs custom persistés en /data/servers.json, mergés aux intégrés), champ custom dans le statut. - app: écran AddServer (form + sélecteur multi-conteneurs filtrable), FAB Ajouter, suppression depuis le détail (serveurs custom only). - thème: palette flamme/chaud sombre (anthracite + orange→rouge), remplace le Material violet/teal par défaut (scaffold, appbar, tabs, boutons, FAB, champs). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
66 lines
1.6 KiB
Dart
66 lines
1.6 KiB
Dart
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.dark(),
|
|
darkTheme: AppTheme.dark(),
|
|
themeMode: ThemeMode.dark,
|
|
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),
|
|
);
|
|
}
|
|
}
|