67 lines
2.5 KiB
Dart
67 lines
2.5 KiB
Dart
import 'package:em2rp/providers/local_user_provider.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class UserManagementPage extends StatelessWidget {
|
|
const UserManagementPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// final userViewModel = Provider.of<UserManagementViewModel>(context);
|
|
final authProvider = Provider.of<LocalUserProvider>(context);
|
|
|
|
if (authProvider.role != 'ADMIN') {
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Gestion des Utilisateurs')),
|
|
body: const Center(
|
|
child: Text('Accès non autorisé',
|
|
style: TextStyle(color: Colors.red))),
|
|
);
|
|
}
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Gestion des Utilisateurs')),
|
|
// body: userViewModel.isLoading
|
|
// ? const Center(child: CircularProgressIndicator())
|
|
// : ListView.builder(
|
|
// itemCount: userViewModel.users.length,
|
|
// itemBuilder: (context, index) {
|
|
// final user = userViewModel.users[index];
|
|
// return ListTile(
|
|
// leading: CircleAvatar(
|
|
// backgroundImage: NetworkImage(user.profilePhotoUrl)),
|
|
// title: Text('${user.firstName} ${user.lastName}'),
|
|
// subtitle: Text(user.email),
|
|
// trailing: Row(
|
|
// mainAxisSize: MainAxisSize.min,
|
|
// children: [
|
|
// IconButton(
|
|
// icon: const Icon(Icons.edit),
|
|
// onPressed: () {
|
|
// // Afficher la pop-up d'édition
|
|
// },
|
|
// ),
|
|
// IconButton(
|
|
// icon: const Icon(Icons.lock_reset),
|
|
// onPressed: () =>
|
|
// userViewModel.resetPassword(user.email),
|
|
// ),
|
|
// IconButton(
|
|
// icon: const Icon(Icons.delete, color: Colors.red),
|
|
// onPressed: () => userViewModel.deleteUser(user.uid),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// );
|
|
// },
|
|
// ),
|
|
// floatingActionButton: FloatingActionButton(
|
|
// onPressed: () {
|
|
// // Ajouter un utilisateur
|
|
// },
|
|
// child: const Icon(Icons.add),
|
|
// ),
|
|
);
|
|
}
|
|
}
|