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
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -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),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user