détail serveur : carte BlueMap intégrée (WebView) + bloc « Se connecter »
Build APK / build (push) Successful in 2m49s
Build APK / build (push) Successful in 2m49s
- Modèle : champ bluemap_url + ConnectInfo (adresse, version, vocal, modpack)
- API : connectInfo() sur /api/servers/{id}/connect (URL mrpack rendue absolue)
- Écran détail : carte BlueMap (WebView, état vide si serveur éteint) + carte Se connecter (copie adresse, vocal, download/copie du .mrpack)
- dep webview_flutter
This commit is contained in:
@@ -6,6 +6,8 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../models.dart';
|
||||
import '../services/api_service.dart';
|
||||
import '../widgets/connect_card.dart';
|
||||
import '../widgets/server_map_card.dart';
|
||||
|
||||
/// Détail d'un serveur : bannière (image importée ou thème), statut, connexion,
|
||||
/// stats d'utilisation (CPU/RAM/réseau) et gestion de l'image (import/suppression).
|
||||
@@ -24,6 +26,8 @@ class _ServerDetailScreenState extends State<ServerDetailScreen> {
|
||||
|
||||
Map<String, dynamic>? _stats;
|
||||
Uint8List? _image;
|
||||
ConnectInfo? _connect;
|
||||
bool _connectLoading = true;
|
||||
bool _busy = false;
|
||||
bool _imgBusy = false;
|
||||
|
||||
@@ -38,12 +42,15 @@ class _ServerDetailScreenState extends State<ServerDetailScreen> {
|
||||
widget.api.stats(s.id).catchError((_) => <String, dynamic>{'running': false}),
|
||||
widget.api.imageBytes(s.id).catchError((_) => null),
|
||||
widget.api.server(s.id).catchError((_) => _server),
|
||||
widget.api.connectInfo(s.id).then<ConnectInfo?>((c) => c).catchError((_) => null),
|
||||
]);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_stats = results[0] as Map<String, dynamic>;
|
||||
_image = results[1] as Uint8List?;
|
||||
_server = results[2] as GameServer;
|
||||
_connect = results[3] as ConnectInfo?;
|
||||
_connectLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -157,10 +164,15 @@ class _ServerDetailScreenState extends State<ServerDetailScreen> {
|
||||
const SizedBox(height: 16),
|
||||
_toggleButton(),
|
||||
const SizedBox(height: 20),
|
||||
if (s.connect != null) _info(Icons.link, 'Connexion', s.connect!),
|
||||
if (s.status == 'online')
|
||||
_info(Icons.people, 'Joueurs', '${s.players ?? 0} / ${s.maxPlayers ?? 0}'),
|
||||
if (s.motd != null) _info(Icons.chat_bubble_outline, 'MOTD', s.motd!),
|
||||
if (s.hasMap) ...[
|
||||
const SizedBox(height: 8),
|
||||
ServerMapCard(url: s.bluemapUrl!, serverUp: s.isUp),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
ConnectCard(info: _connect, loading: _connectLoading),
|
||||
const SizedBox(height: 20),
|
||||
_statsCard(),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
Reference in New Issue
Block a user