Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0257f0fa05 |
@@ -101,17 +101,23 @@ class _ServersScreenState extends State<ServersScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return DefaultTabController(
|
||||||
|
length: 2,
|
||||||
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Serveurs'),
|
title: const Text('Serveurs'),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(onPressed: _openSettings, icon: const Icon(Icons.settings_outlined)),
|
IconButton(onPressed: _openSettings, icon: const Icon(Icons.settings_outlined)),
|
||||||
IconButton(onPressed: _logout, icon: const Icon(Icons.logout)),
|
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: RefreshIndicator(
|
),
|
||||||
onRefresh: _refresh,
|
body: _buildBody(),
|
||||||
child: _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)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user