feat: Enhance admin panel navigation and UI by implementing tab management and improving layout structure
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-11 10:10:03 +02:00
parent 06492ff099
commit afbc5b91b2
5 changed files with 128 additions and 148 deletions
@@ -345,22 +345,6 @@ class _AdminUsersPanelState extends ConsumerState<AdminUsersPanel> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final activeFilters = <String>[
if (_filterAdminOnly) 'Endast admin',
if (_filterPremiumOnly) 'Endast premium',
if (_filterSharingOffOnly) 'Delning avstängd',
];
final searchSummary = _search.trim().isEmpty
? 'Ingen aktiv sökning'
: 'Sökning: "${_search.trim()}"';
final filterSummary = activeFilters.isEmpty
? 'Inga aktiva snabbfilter'
: 'Aktiva filter: ${activeFilters.join(', ')}';
final viewSummary = 'Sortering: ${_sortLabel(_sort)}$searchSummary$filterSummary';
if (_isLoading) {
return const Center(child: CircularProgressIndicator());
}
@@ -440,38 +424,43 @@ class _AdminUsersPanelState extends ConsumerState<AdminUsersPanel> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
spacing: 8,
runSpacing: 8,
children: [
FilterChip(
label: const Text('Endast admin'),
selected: _filterAdminOnly,
onSelected: (value) => setState(() => _filterAdminOnly = value),
),
FilterChip(
label: const Text('Endast premium'),
selected: _filterPremiumOnly,
onSelected: (value) => setState(() => _filterPremiumOnly = value),
),
FilterChip(
label: const Text('Delning avstängd'),
selected: _filterSharingOffOnly,
onSelected: (value) => setState(() => _filterSharingOffOnly = value),
),
if (_filterAdminOnly || _filterPremiumOnly || _filterSharingOffOnly)
TextButton.icon(
onPressed: () {
setState(() {
_filterAdminOnly = false;
_filterPremiumOnly = false;
_filterSharingOffOnly = false;
});
},
icon: const Icon(Icons.clear_all),
label: const Text('Rensa filter'),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
FilterChip(
label: const Text('Endast admin'),
selected: _filterAdminOnly,
onSelected: (value) => setState(() => _filterAdminOnly = value),
),
],
const SizedBox(width: 8),
FilterChip(
label: const Text('Endast premium'),
selected: _filterPremiumOnly,
onSelected: (value) => setState(() => _filterPremiumOnly = value),
),
const SizedBox(width: 8),
FilterChip(
label: const Text('Delning avstängd'),
selected: _filterSharingOffOnly,
onSelected: (value) => setState(() => _filterSharingOffOnly = value),
),
if (_filterAdminOnly || _filterPremiumOnly || _filterSharingOffOnly) ...[
const SizedBox(width: 8),
TextButton.icon(
onPressed: () {
setState(() {
_filterAdminOnly = false;
_filterPremiumOnly = false;
_filterSharingOffOnly = false;
});
},
icon: const Icon(Icons.clear_all),
label: const Text('Rensa filter'),
),
],
],
),
),
const SizedBox(height: 8),
Row(
@@ -520,17 +509,24 @@ class _AdminUsersPanelState extends ConsumerState<AdminUsersPanel> {
),
],
),
Text(
'Visar ${visibleUsers.length} av ${_users.length} användare',
style: theme.textTheme.bodySmall,
),
const SizedBox(height: 8),
FilledButton.icon(
onPressed: _createUser,
icon: const Icon(Icons.person_add_outlined),
label: Text(context.l10n.adminNewUser),
Row(
children: [
Expanded(
child: Text(
'Visar ${visibleUsers.length} av ${_users.length} användare',
style: theme.textTheme.bodySmall,
),
),
const SizedBox(width: 8),
FilledButton.icon(
onPressed: _createUser,
icon: const Icon(Icons.person_add_outlined),
label: Text(context.l10n.adminNewUser),
),
],
),
const SizedBox(height: 16),
const SizedBox(height: 12),
Expanded(child: list),
],
),