90 lines
3.1 KiB
Dart
90 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import '../../../core/l10n/l10n.dart';
|
|
import 'admin_database_panel.dart';
|
|
import 'admin_users_panel.dart';
|
|
|
|
class AdminScreen extends ConsumerStatefulWidget {
|
|
const AdminScreen({super.key});
|
|
|
|
@override
|
|
ConsumerState<AdminScreen> createState() => _AdminScreenState();
|
|
}
|
|
|
|
class _AdminScreenState extends ConsumerState<AdminScreen> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return DefaultTabController(
|
|
length: 2,
|
|
child: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
|
|
child: Card(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Admin', style: theme.textTheme.titleMedium),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'Användare är för konton och roller. Databas är arbetsytan för inventarie, baslager, produkter, alias och importflöden.',
|
|
style: theme.textTheme.bodyMedium,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Wrap(
|
|
spacing: 8,
|
|
runSpacing: 8,
|
|
children: [
|
|
ActionChip(
|
|
label: const Text('Konton'),
|
|
onPressed: () => DefaultTabController.of(context).animateTo(0),
|
|
),
|
|
ActionChip(
|
|
label: const Text('Databas'),
|
|
onPressed: () => DefaultTabController.of(context).animateTo(1),
|
|
),
|
|
ActionChip(
|
|
label: const Text('Privat + globalt'),
|
|
onPressed: () => DefaultTabController.of(context).animateTo(1),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Material(
|
|
color: Theme.of(context).colorScheme.surface,
|
|
child: TabBar(
|
|
isScrollable: true,
|
|
tabs: [
|
|
Tab(text: context.l10n.profileUsersTab, icon: const Icon(Icons.people_outline)),
|
|
const Tab(text: 'Databas', icon: Icon(Icons.storage_outlined)),
|
|
],
|
|
),
|
|
),
|
|
const Expanded(
|
|
child: TabBarView(
|
|
children: [
|
|
Padding(
|
|
padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
|
|
child: AdminUsersPanel(embedded: true),
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.fromLTRB(12, 12, 12, 8),
|
|
child: AdminDatabasePanel(embedded: true),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|