105 lines
2.7 KiB
Dart
105 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'user_list_screen.dart';
|
|
import 'deviation_list_screen.dart';
|
|
|
|
class AdminDashboardScreen extends ConsumerWidget {
|
|
const AdminDashboardScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Admin Dashboard'),
|
|
),
|
|
body: ListView(
|
|
padding: const EdgeInsets.all(16.0),
|
|
children: [
|
|
_AdminCard(
|
|
title: 'Ansatte',
|
|
icon: Icons.people,
|
|
color: Colors.blue,
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (context) => const UserListScreen()),
|
|
);
|
|
},
|
|
),
|
|
const SizedBox(height: 16),
|
|
_AdminCard(
|
|
title: 'Avvik',
|
|
icon: Icons.warning_amber,
|
|
color: Colors.orange,
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (context) => const DeviationListScreen()),
|
|
);
|
|
},
|
|
),
|
|
const SizedBox(height: 16),
|
|
_AdminCard(
|
|
title: 'Rapporter',
|
|
icon: Icons.bar_chart,
|
|
color: Colors.green,
|
|
onTap: () {
|
|
// TODO: Implementer admin-rapporter
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(content: Text('Kommer snart')),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _AdminCard extends StatelessWidget {
|
|
final String title;
|
|
final IconData icon;
|
|
final Color color;
|
|
final VoidCallback onTap;
|
|
|
|
const _AdminCard({
|
|
required this.title,
|
|
required this.icon,
|
|
required this.color,
|
|
required this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
elevation: 2,
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24.0),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
color: color.withOpacity(0.1),
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Icon(icon, size: 32, color: color),
|
|
),
|
|
const SizedBox(width: 24),
|
|
Text(
|
|
title,
|
|
style: Theme.of(context).textTheme.titleLarge,
|
|
),
|
|
const Spacer(),
|
|
const Icon(Icons.chevron_right),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|