Add profile in parameters, initialized page map, group, count.
This commit is contained in:
13
lib/components/count/count_content.dart
Normal file
13
lib/components/count/count_content.dart
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CountContent extends StatelessWidget {
|
||||||
|
const CountContent({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: const Text('Count Page')),
|
||||||
|
body: const Center(child: Text('This is the Count Page')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
13
lib/components/group/group_content.dart
Normal file
13
lib/components/group/group_content.dart
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class GroupContent extends StatelessWidget {
|
||||||
|
const GroupContent({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: const Text('Group Page')),
|
||||||
|
body: const Center(child: Text('This is the Group Page')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
24
lib/components/map/map_content.dart
Normal file
24
lib/components/map/map_content.dart
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MapContent extends StatelessWidget {
|
||||||
|
const MapContent({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.map, size: 80, color: Colors.green),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
Text(
|
||||||
|
'Page de la Carte',
|
||||||
|
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10),
|
||||||
|
Text('Ici sera intégrée Google Maps'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,32 +1,242 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import '../../providers/user_provider.dart';
|
||||||
|
|
||||||
class ProfileContent extends StatelessWidget {
|
class ProfileContent extends StatelessWidget {
|
||||||
const ProfileContent({super.key});
|
const ProfileContent({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Consumer<UserProvider>(
|
||||||
padding: EdgeInsets.all(16),
|
builder: (context, userProvider, child) {
|
||||||
child: Center(
|
final user = userProvider.currentUser;
|
||||||
child: Column(
|
|
||||||
|
if (user == null) {
|
||||||
|
return Center(child: Text('Aucun utilisateur connecté'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
// Section titre
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
|
||||||
radius: 50,
|
|
||||||
backgroundColor: Colors.blue,
|
|
||||||
child: Icon(Icons.person, size: 50, color: Colors.white),
|
|
||||||
),
|
|
||||||
SizedBox(height: 20),
|
|
||||||
Text(
|
Text(
|
||||||
'Nom d\'utilisateur',
|
'Profil utilisateur',
|
||||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.grey[600],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10),
|
|
||||||
Text('email@example.com'),
|
|
||||||
SizedBox(height: 30),
|
|
||||||
ElevatedButton(onPressed: () {}, child: Text('Modifier le profil')),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Card du profil
|
||||||
|
Card(
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Photo de profil
|
||||||
|
CircleAvatar(
|
||||||
|
radius: 40,
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
|
child: Text(
|
||||||
|
user.prenom[0].toUpperCase() +
|
||||||
|
user.nom[0].toUpperCase(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(height: 16),
|
||||||
|
|
||||||
|
// Nom complet
|
||||||
|
Text(
|
||||||
|
user.fullName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(height: 8),
|
||||||
|
|
||||||
|
// Email
|
||||||
|
Text(
|
||||||
|
user.email,
|
||||||
|
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Actions du profil
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.edit),
|
||||||
|
title: Text('Modifier le profil'),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios),
|
||||||
|
onTap: () {
|
||||||
|
_showEditProfileDialog(context, user);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.lock),
|
||||||
|
title: Text('Changer le mot de passe'),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios),
|
||||||
|
onTap: () {
|
||||||
|
_showChangePasswordDialog(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
Divider(),
|
||||||
|
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.delete, color: Colors.red),
|
||||||
|
title: Text('Supprimer le compte'),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios),
|
||||||
|
onTap: () {
|
||||||
|
_showDeleteAccountDialog(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showEditProfileDialog(BuildContext context, user) {
|
||||||
|
final nomController = TextEditingController(text: user.nom);
|
||||||
|
final prenomController = TextEditingController(text: user.prenom);
|
||||||
|
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('Modifier le profil'),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
controller: prenomController,
|
||||||
|
decoration: InputDecoration(labelText: 'Prénom'),
|
||||||
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
TextField(
|
||||||
|
controller: nomController,
|
||||||
|
decoration: InputDecoration(labelText: 'Nom'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text('Annuler'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
// TODO: Implémenter la mise à jour
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
ScaffoldMessenger.of(
|
||||||
|
context,
|
||||||
|
).showSnackBar(SnackBar(content: Text('Profil mis à jour !')));
|
||||||
|
},
|
||||||
|
child: Text('Sauvegarder'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showChangePasswordDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('Changer le mot de passe'),
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
obscureText: true,
|
||||||
|
decoration: InputDecoration(labelText: 'Mot de passe actuel'),
|
||||||
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
TextField(
|
||||||
|
obscureText: true,
|
||||||
|
decoration: InputDecoration(labelText: 'Nouveau mot de passe'),
|
||||||
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
TextField(
|
||||||
|
obscureText: true,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'Confirmer le mot de passe',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text('Annuler'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
// TODO: Implémenter le changement de mot de passe
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text('Mot de passe changé !')),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text('Changer'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showDeleteAccountDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('Supprimer le compte'),
|
||||||
|
content: Text(
|
||||||
|
'Êtes-vous sûr de vouloir supprimer votre compte ? Cette action est irréversible.',
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text('Annuler'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
// TODO: Implémenter la suppression
|
||||||
|
Provider.of<UserProvider>(context, listen: false).logout();
|
||||||
|
Navigator.pushNamedAndRemoveUntil(
|
||||||
|
context,
|
||||||
|
'/login',
|
||||||
|
(route) => false,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
style: TextButton.styleFrom(foregroundColor: Colors.red),
|
||||||
|
child: Text('Supprimer'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'settings_theme_content.dart';
|
import 'settings_theme_content.dart';
|
||||||
|
import '../profile/profile_content.dart';
|
||||||
|
|
||||||
class SettingsContent extends StatelessWidget {
|
class SettingsContent extends StatelessWidget {
|
||||||
const SettingsContent({super.key});
|
const SettingsContent({super.key});
|
||||||
@@ -15,6 +16,22 @@ class SettingsContent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
|
|
||||||
|
// Section Profil intégrée
|
||||||
|
ProfileContent(),
|
||||||
|
|
||||||
|
SizedBox(height: 20),
|
||||||
|
|
||||||
|
// Autres paramètres
|
||||||
|
Text(
|
||||||
|
'Préférences',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.grey[600],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.palette),
|
leading: Icon(Icons.palette),
|
||||||
title: Text('Thème'),
|
title: Text('Thème'),
|
||||||
@@ -28,13 +45,6 @@ class SettingsContent extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
ListTile(
|
|
||||||
leading: Icon(Icons.person),
|
|
||||||
title: Text('Profil'),
|
|
||||||
trailing: Icon(Icons.arrow_forward_ios),
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.notifications),
|
leading: Icon(Icons.notifications),
|
||||||
title: Text('Notifications'),
|
title: Text('Notifications'),
|
||||||
|
|||||||
@@ -5,11 +5,17 @@ import 'package:travel_mate/pages/signup.dart';
|
|||||||
import 'pages/login.dart';
|
import 'pages/login.dart';
|
||||||
import 'pages/home.dart';
|
import 'pages/home.dart';
|
||||||
import 'providers/theme_provider.dart';
|
import 'providers/theme_provider.dart';
|
||||||
|
import 'providers/user_provider.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(
|
runApp(
|
||||||
|
MultiProvider(
|
||||||
|
providers: [
|
||||||
|
ChangeNotifierProvider(create: (context) => ThemeProvider()),
|
||||||
ChangeNotifierProvider(
|
ChangeNotifierProvider(
|
||||||
create: (context) => ThemeProvider(),
|
create: (context) => UserProvider(),
|
||||||
|
), // Ajoutez cette ligne
|
||||||
|
],
|
||||||
child: const MyApp(),
|
child: const MyApp(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../components/home/home_content.dart';
|
import '../components/home/home_content.dart';
|
||||||
import '../components/settings/settings_content.dart';
|
import '../components/settings/settings_content.dart';
|
||||||
import '../components/profile/profile_content.dart';
|
import '../components/map/map_content.dart';
|
||||||
|
import '../components/group/group_content.dart';
|
||||||
|
import '../components/count/count_content.dart';
|
||||||
|
|
||||||
class HomePage extends StatefulWidget {
|
class HomePage extends StatefulWidget {
|
||||||
const HomePage({super.key});
|
const HomePage({super.key});
|
||||||
@@ -13,21 +15,28 @@ class HomePage extends StatefulWidget {
|
|||||||
class _HomePageState extends State<HomePage> {
|
class _HomePageState extends State<HomePage> {
|
||||||
int _currentIndex = 0;
|
int _currentIndex = 0;
|
||||||
|
|
||||||
// Liste des composants à afficher
|
|
||||||
final List<Widget> _pages = [
|
|
||||||
HomeContent(),
|
|
||||||
SettingsContent(),
|
|
||||||
ProfileContent(),
|
|
||||||
];
|
|
||||||
|
|
||||||
// Titres correspondants
|
|
||||||
final List<String> _titles = ['Accueil', 'Paramètres', 'Profil'];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
// Définir les pages directement dans le build pour éviter les erreurs
|
||||||
|
final List<Widget> pages = [
|
||||||
|
HomeContent(), // 0
|
||||||
|
SettingsContent(), // 1
|
||||||
|
MapContent(), // 2
|
||||||
|
GroupContent(), // 3
|
||||||
|
CountContent(), // 4
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<String> titles = [
|
||||||
|
'Accueil', // 0
|
||||||
|
'Paramètres', // 1
|
||||||
|
'Carte', // 2
|
||||||
|
'Mes groupes', // 3
|
||||||
|
'Comptes', // 4
|
||||||
|
];
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(_titles[_currentIndex]),
|
title: Text(titles[_currentIndex]), // Debug
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
),
|
),
|
||||||
@@ -49,6 +58,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
title: Text("Accueil"),
|
title: Text("Accueil"),
|
||||||
selected: _currentIndex == 0,
|
selected: _currentIndex == 0,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
print('Clicked Accueil - Setting index to 0'); // Debug
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex = 0;
|
_currentIndex = 0;
|
||||||
});
|
});
|
||||||
@@ -60,6 +70,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
title: Text("Paramètres"),
|
title: Text("Paramètres"),
|
||||||
selected: _currentIndex == 1,
|
selected: _currentIndex == 1,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
print('Clicked Paramètres - Setting index to 1'); // Debug
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex = 1;
|
_currentIndex = 1;
|
||||||
});
|
});
|
||||||
@@ -67,16 +78,41 @@ class _HomePageState extends State<HomePage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.person),
|
leading: Icon(Icons.map),
|
||||||
title: Text("Profil"),
|
title: Text("Carte"),
|
||||||
selected: _currentIndex == 2,
|
selected: _currentIndex == 2,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
print('Clicked Carte - Setting index to 2'); // Debug
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex = 2;
|
_currentIndex = 2;
|
||||||
});
|
});
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.group),
|
||||||
|
title: Text("Mes groupes"),
|
||||||
|
selected: _currentIndex == 3,
|
||||||
|
onTap: () {
|
||||||
|
print('Clicked Groupes - Setting index to 3'); // Debug
|
||||||
|
setState(() {
|
||||||
|
_currentIndex = 3;
|
||||||
|
});
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.account_balance_wallet),
|
||||||
|
title: Text("Comptes"),
|
||||||
|
selected: _currentIndex == 4,
|
||||||
|
onTap: () {
|
||||||
|
print('Clicked Comptes - Setting index to 4'); // Debug
|
||||||
|
setState(() {
|
||||||
|
_currentIndex = 4;
|
||||||
|
});
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
Divider(),
|
Divider(),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.logout, color: Colors.red),
|
leading: Icon(Icons.logout, color: Colors.red),
|
||||||
@@ -93,7 +129,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: _pages[_currentIndex],
|
body: pages[_currentIndex],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../models/user.dart';
|
import '../models/user.dart';
|
||||||
import '../services/user_service.dart';
|
import '../services/user_service.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import '../providers/user_provider.dart';
|
||||||
|
|
||||||
class LoginPage extends StatefulWidget {
|
class LoginPage extends StatefulWidget {
|
||||||
const LoginPage({super.key});
|
const LoginPage({super.key});
|
||||||
@@ -63,6 +65,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
// Naviguer vers la page d'accueil
|
// Naviguer vers la page d'accueil
|
||||||
|
Provider.of<UserProvider>(context, listen: false).setCurrentUser(user);
|
||||||
Navigator.pushReplacementNamed(context, '/home');
|
Navigator.pushReplacementNamed(context, '/home');
|
||||||
} else {
|
} else {
|
||||||
// Échec de la connexion
|
// Échec de la connexion
|
||||||
|
|||||||
20
lib/providers/user_provider.dart
Normal file
20
lib/providers/user_provider.dart
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../models/user.dart';
|
||||||
|
|
||||||
|
class UserProvider extends ChangeNotifier {
|
||||||
|
User? _currentUser;
|
||||||
|
|
||||||
|
User? get currentUser => _currentUser;
|
||||||
|
|
||||||
|
void setCurrentUser(User user) {
|
||||||
|
_currentUser = user;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void logout() {
|
||||||
|
_currentUser = null;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get isLoggedIn => _currentUser != null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user