1 Commits
Author SHA1 Message Date
neckfireandClaude Opus 4.8 0257f0fa05 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>
2026-07-13 11:33:12 +02:00
+33 -46
View File
@@ -101,17 +101,23 @@ class _ServersScreenState extends State<ServersScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Serveurs'),
actions: [
IconButton(onPressed: _openSettings, icon: const Icon(Icons.settings_outlined)),
IconButton(onPressed: _logout, icon: const Icon(Icons.logout)),
],
),
body: RefreshIndicator(
onRefresh: _refresh,
child: _buildBody(),
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
title: const Text('Serveurs'),
actions: [
IconButton(onPressed: _openSettings, icon: const Icon(Icons.settings_outlined)),
IconButton(onPressed: _logout, icon: const Icon(Icons.logout)),
],
bottom: const TabBar(
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 preprod = _servers!.where((s) => s.isPreprod).toList();
final children = <Widget>[];
if (prod.isNotEmpty) {
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 TabBarView(
children: [_envList(prod), _envList(preprod)],
);
}
return ListView(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 24),
children: children,
Widget _envList(List<GameServer> list) {
return RefreshIndicator(
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)),
],
),
);
}
}