feat(ui): preprod dans un onglet séparé (TabBar Production / Preprod)
Build APK / build (push) Successful in 2m27s

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
neckfire
2026-07-13 11:33:12 +02:00
co-authored by Claude Opus 4.8
parent 25890d7bbc
commit 0257f0fa05
+33 -46
View File
@@ -101,17 +101,23 @@ class _ServersScreenState extends State<ServersScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return DefaultTabController(
appBar: AppBar( length: 2,
title: const Text('Serveurs'), child: Scaffold(
actions: [ appBar: AppBar(
IconButton(onPressed: _openSettings, icon: const Icon(Icons.settings_outlined)), title: const Text('Serveurs'),
IconButton(onPressed: _logout, icon: const Icon(Icons.logout)), actions: [
], IconButton(onPressed: _openSettings, icon: const Icon(Icons.settings_outlined)),
), IconButton(onPressed: _logout, icon: const Icon(Icons.logout)),
body: RefreshIndicator( ],
onRefresh: _refresh, bottom: const TabBar(
child: _buildBody(), tabs: [
Tab(icon: Icon(Icons.public), text: 'Production'),
Tab(icon: Icon(Icons.science_outlined), text: 'Preprod'),
],
),
),
body: _buildBody(),
), ),
); );
} }
@@ -134,19 +140,23 @@ class _ServersScreenState extends State<ServersScreen> {
final prod = _servers!.where((s) => !s.isPreprod).toList(); final prod = _servers!.where((s) => !s.isPreprod).toList();
final preprod = _servers!.where((s) => s.isPreprod).toList(); final preprod = _servers!.where((s) => s.isPreprod).toList();
final children = <Widget>[]; return TabBarView(
if (prod.isNotEmpty) { children: [_envList(prod), _envList(preprod)],
children.add(const _SectionHeader(label: 'Production', icon: Icons.public)); );
children.addAll(prod.map(_card)); }
}
if (preprod.isNotEmpty) {
children.add(const _SectionHeader(label: 'Preprod', icon: Icons.science_outlined));
children.addAll(preprod.map(_card));
}
return ListView( Widget _envList(List<GameServer> list) {
padding: const EdgeInsets.fromLTRB(16, 4, 16, 24), return RefreshIndicator(
children: children, onRefresh: _refresh,
child: list.isEmpty
? ListView(children: const [
SizedBox(height: 120),
Center(child: Text('Aucun serveur dans cet environnement.')),
])
: ListView(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 24),
children: list.map(_card).toList(),
),
); );
} }
@@ -163,26 +173,3 @@ class _ServersScreenState extends State<ServersScreen> {
), ),
); );
} }
class _SectionHeader extends StatelessWidget {
const _SectionHeader({required this.label, required this.icon});
final String label;
final IconData icon;
@override
Widget build(BuildContext context) {
final c = Theme.of(context).colorScheme.onSurfaceVariant;
return Padding(
padding: const EdgeInsets.fromLTRB(4, 14, 4, 10),
child: Row(
children: [
Icon(icon, size: 18, color: c),
const SizedBox(width: 8),
Text(label.toUpperCase(),
style: TextStyle(
color: c, fontSize: 13, fontWeight: FontWeight.w800, letterSpacing: 1.1)),
],
),
);
}
}