Le menu de la page principale après s'être authentifié est ok
This commit is contained in:
@@ -2,7 +2,7 @@ import 'package:get_it/get_it.dart';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import '../../data/datasources/user_remote_data_source.dart';
|
import '../../data/datasources/user_remote_data_source.dart';
|
||||||
import '../../data/datasources/user_repository_impl.dart';
|
import '../../data/repositories/user_repository_impl.dart';
|
||||||
import '../../domain/usecases/get_user.dart';
|
import '../../domain/usecases/get_user.dart';
|
||||||
|
|
||||||
final sl = GetIt.instance;
|
final sl = GetIt.instance;
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:afterwork/presentation/screens/login/login_screen.dart';
|
import 'package:afterwork/presentation/screens/login/login_screen.dart';
|
||||||
|
import 'package:afterwork/presentation/screens/home/home_screen.dart';
|
||||||
|
import 'package:afterwork/presentation/screens/event/event_screen.dart';
|
||||||
|
import 'package:afterwork/presentation/screens/story/story_screen.dart';
|
||||||
|
|
||||||
class AppRouter {
|
class AppRouter {
|
||||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||||
switch (settings.name) {
|
switch (settings.name) {
|
||||||
case '/':
|
case '/':
|
||||||
return MaterialPageRoute(builder: (_) => const LoginScreen());
|
return MaterialPageRoute(builder: (_) => const LoginScreen());
|
||||||
// Ajoute d'autres routes ici
|
case '/home':
|
||||||
|
return MaterialPageRoute(builder: (_) => const HomeScreen());
|
||||||
|
case '/event':
|
||||||
|
return MaterialPageRoute(builder: (_) => const EventScreen());
|
||||||
|
case '/story':
|
||||||
|
return MaterialPageRoute(builder: (_) => const StoryScreen());
|
||||||
default:
|
default:
|
||||||
return MaterialPageRoute(
|
return MaterialPageRoute(
|
||||||
builder: (_) => const Scaffold(
|
builder: (_) => const Scaffold(
|
||||||
|
|||||||
0
lib/core/constants/colors.dart
Normal file
0
lib/core/constants/colors.dart
Normal file
21
lib/core/utils/validators.dart
Normal file
21
lib/core/utils/validators.dart
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
class Validators {
|
||||||
|
static String? validateEmail(String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Veuillez entrer votre email';
|
||||||
|
}
|
||||||
|
if (!RegExp(r'^[^@]+@[^@]+\.[^@]+').hasMatch(value)) {
|
||||||
|
return 'Veuillez entrer un email valide';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static String? validatePassword(String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Veuillez entrer votre mot de passe';
|
||||||
|
}
|
||||||
|
if (value.length < 6) {
|
||||||
|
return 'Le mot de passe doit comporter au moins 6 caractères';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,8 @@ class AfterWorkApp extends StatelessWidget {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'AfterWork',
|
title: 'AfterWork',
|
||||||
theme: AppTheme.lightTheme,
|
theme: AppTheme.lightTheme,
|
||||||
|
darkTheme: AppTheme.darkTheme, // Ajout du thème sombre
|
||||||
|
themeMode: ThemeMode.system, // Choix automatique du thème en fonction du système
|
||||||
onGenerateRoute: AppRouter.generateRoute,
|
onGenerateRoute: AppRouter.generateRoute,
|
||||||
initialRoute: '/',
|
initialRoute: '/',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,12 +7,47 @@ class EventScreen extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Événements'),
|
title: const Text('Créer un Événement'),
|
||||||
|
backgroundColor: Colors.blueAccent,
|
||||||
),
|
),
|
||||||
body: const Center(
|
body: Padding(
|
||||||
child: Text('Liste des événements'),
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'Titre de l\'événement',
|
||||||
|
style: TextStyle(fontSize: 18, color: Colors.white),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
TextField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Entrez le titre de l\'événement',
|
||||||
|
filled: true,
|
||||||
|
fillColor: Colors.white.withOpacity(0.1),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
borderSide: BorderSide.none,
|
||||||
|
),
|
||||||
|
hintStyle: const TextStyle(color: Colors.white70),
|
||||||
|
),
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
// Logique pour créer l'événement
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.blueAccent,
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
),
|
||||||
|
child: const Text('Créer l\'événement'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,172 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class HomeScreen extends StatelessWidget {
|
class HomeScreen extends StatefulWidget {
|
||||||
const HomeScreen({super.key});
|
const HomeScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_HomeScreenState createState() => _HomeScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMixin {
|
||||||
|
late TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(length: 5, vsync: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_tabController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onMenuSelected(BuildContext context, String option) {
|
||||||
|
// Implémente la logique pour chaque option ici
|
||||||
|
switch (option) {
|
||||||
|
case 'Publier':
|
||||||
|
// Redirige vers la page de publication
|
||||||
|
break;
|
||||||
|
case 'Story':
|
||||||
|
// Redirige vers la page de création de Story
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('AfterWork'),
|
backgroundColor: Colors.black, // Fond noir pour l'AppBar
|
||||||
|
elevation: 0, // Enlève l'ombre sous l'AppBar
|
||||||
|
leading: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Image.asset(
|
||||||
|
'lib/assets/images/logo.png', // Chemin correct de ton logo
|
||||||
|
height: 40,
|
||||||
),
|
),
|
||||||
body: const Center(
|
),
|
||||||
child: Text('Bienvenue sur AfterWork!'),
|
actions: [
|
||||||
|
// Bouton +
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundColor: Colors.white, // Cercle blanc
|
||||||
|
radius: 18, // Réduit la taille du bouton
|
||||||
|
child: PopupMenuButton<String>(
|
||||||
|
onSelected: (value) => _onMenuSelected(context, value),
|
||||||
|
itemBuilder: (context) => [
|
||||||
|
const PopupMenuItem(
|
||||||
|
value: 'Publier',
|
||||||
|
child: Text('Publier'),
|
||||||
|
),
|
||||||
|
const PopupMenuItem(
|
||||||
|
value: 'Story',
|
||||||
|
child: Text('Story'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
icon: const Icon(Icons.add, color: Colors.blueAccent, size: 20), // Icône bleue légèrement plus petite
|
||||||
|
color: Colors.white, // Menu contextuel en blanc
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8), // Réduit l'espacement entre les boutons
|
||||||
|
// Bouton Recherche
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
radius: 18, // Réduit la taille du bouton
|
||||||
|
child: IconButton(
|
||||||
|
icon: const Icon(Icons.search, color: Colors.blueAccent, size: 20), // Icône bleue légèrement plus petite
|
||||||
|
onPressed: () {
|
||||||
|
// Implémente la logique de recherche ici
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8), // Réduit l'espacement entre les boutons
|
||||||
|
// Bouton Messagerie
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
radius: 18, // Réduit la taille du bouton
|
||||||
|
child: IconButton(
|
||||||
|
icon: const Icon(Icons.message, color: Colors.blueAccent, size: 20), // Icône bleue légèrement plus petite
|
||||||
|
onPressed: () {
|
||||||
|
// Implémente la logique de messagerie ici
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8), // Réduit l'espacement entre les boutons
|
||||||
|
],
|
||||||
|
bottom: TabBar(
|
||||||
|
controller: _tabController,
|
||||||
|
indicatorColor: Colors.blueAccent,
|
||||||
|
tabs: const [
|
||||||
|
Tab(icon: Icon(Icons.home), text: 'Accueil'),
|
||||||
|
Tab(icon: Icon(Icons.event), text: 'Événements'),
|
||||||
|
Tab(icon: Icon(Icons.location_city), text: 'Établissements'),
|
||||||
|
Tab(icon: Icon(Icons.people), text: 'Social'),
|
||||||
|
Tab(icon: Icon(Icons.person), text: 'Profil'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: TabBarView(
|
||||||
|
controller: _tabController,
|
||||||
|
children: [
|
||||||
|
_getSelectedScreen(0),
|
||||||
|
_getSelectedScreen(1),
|
||||||
|
_getSelectedScreen(2),
|
||||||
|
_getSelectedScreen(3),
|
||||||
|
_getSelectedScreen(4),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.black, // Arrière-plan de l'écran en noir
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cette méthode retourne le widget correspondant à l'index sélectionné
|
||||||
|
Widget _getSelectedScreen(int index) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'Accueil',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 1:
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'Événements',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 2:
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'Établissements',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 3:
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'Social',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 4:
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'Profil',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return const Center(
|
||||||
|
child: Text(
|
||||||
|
'Accueil',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:afterwork/data/datasources/user_remote_data_source.dart';
|
import 'package:afterwork/data/datasources/user_remote_data_source.dart';
|
||||||
import 'package:afterwork/data/models/user_model.dart';
|
import 'package:afterwork/data/models/user_model.dart';
|
||||||
|
import 'package:afterwork/presentation/screens/home/home_screen.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
class LoginScreen extends StatefulWidget {
|
class LoginScreen extends StatefulWidget {
|
||||||
@@ -10,14 +11,36 @@ class LoginScreen extends StatefulWidget {
|
|||||||
_LoginScreenState createState() => _LoginScreenState();
|
_LoginScreenState createState() => _LoginScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LoginScreenState extends State<LoginScreen> {
|
class _LoginScreenState extends State<LoginScreen> with SingleTickerProviderStateMixin {
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
String _email = ''; // Initialisation par défaut
|
String _email = '';
|
||||||
String _password = ''; // Initialisation par défaut
|
String _password = '';
|
||||||
bool _isPasswordVisible = false;
|
bool _isPasswordVisible = false;
|
||||||
|
bool _isSubmitting = false;
|
||||||
|
|
||||||
final UserRemoteDataSource _userRemoteDataSource = UserRemoteDataSource(http.Client());
|
final UserRemoteDataSource _userRemoteDataSource = UserRemoteDataSource(http.Client());
|
||||||
|
|
||||||
|
late AnimationController _controller;
|
||||||
|
late Animation<double> _buttonScaleAnimation;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_controller = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
);
|
||||||
|
_buttonScaleAnimation = Tween<double>(begin: 1.0, end: 1.1).animate(
|
||||||
|
CurvedAnimation(parent: _controller, curve: Curves.easeInOut),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
void _togglePasswordVisibility() {
|
void _togglePasswordVisibility() {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isPasswordVisible = !_isPasswordVisible;
|
_isPasswordVisible = !_isPasswordVisible;
|
||||||
@@ -26,30 +49,30 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
|
|
||||||
void _submit() async {
|
void _submit() async {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
|
setState(() {
|
||||||
|
_isSubmitting = true;
|
||||||
|
});
|
||||||
_formKey.currentState!.save();
|
_formKey.currentState!.save();
|
||||||
|
|
||||||
print('Email: $_email'); // Pour vérifier la valeur de l'email
|
|
||||||
print('Mot de passe: $_password'); // Pour vérifier la valeur du mot de passe
|
|
||||||
|
|
||||||
if (_email.isEmpty || _password.isEmpty) {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
const SnackBar(content: Text('Veuillez remplir tous les champs')),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UserModel user = await _userRemoteDataSource.authenticateUser(_email, _password);
|
UserModel user = await _userRemoteDataSource.authenticateUser(_email, _password);
|
||||||
print('Connexion réussie : ${user.email}');
|
print('Connexion réussie : ${user.email}');
|
||||||
// Naviguer vers la page d'accueil ou autre
|
|
||||||
|
// Navigation vers la page d'accueil
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => const HomeScreen()),
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Erreur lors de la connexion: $e');
|
print('Erreur lors de la connexion: $e');
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(e.toString())),
|
SnackBar(content: Text(e.toString())),
|
||||||
);
|
);
|
||||||
|
} finally {
|
||||||
|
setState(() {
|
||||||
|
_isSubmitting = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
print('Formulaire invalide');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,14 +81,16 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
final size = MediaQuery.of(context).size;
|
final size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.white,
|
|
||||||
body: Stack(
|
body: Stack(
|
||||||
children: [
|
children: [
|
||||||
// Arrière-plan
|
// Arrière-plan avec dégradé
|
||||||
Positioned.fill(
|
Container(
|
||||||
child: Image.asset(
|
decoration: const BoxDecoration(
|
||||||
'lib/assets/images/background.webp', // Remplace par le chemin de ton image
|
gradient: LinearGradient(
|
||||||
fit: BoxFit.cover,
|
colors: [Color(0xFF4A90E2), Color(0xFF9013FE)],
|
||||||
|
begin: Alignment.topLeft,
|
||||||
|
end: Alignment.bottomRight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Contenu de la page
|
// Contenu de la page
|
||||||
@@ -77,27 +102,56 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
// Logo avec légère animation
|
||||||
|
AnimatedBuilder(
|
||||||
|
animation: _controller,
|
||||||
|
builder: (context, child) {
|
||||||
|
return Transform.scale(
|
||||||
|
scale: _buttonScaleAnimation.value,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: GestureDetector(
|
||||||
|
onTapDown: (_) => _controller.forward(),
|
||||||
|
onTapUp: (_) => _controller.reverse(),
|
||||||
|
child: Image.asset(
|
||||||
'lib/assets/images/logo.png',
|
'lib/assets/images/logo.png',
|
||||||
height: size.height * 0.2,
|
height: size.height * 0.2,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Text(
|
const Text(
|
||||||
'Bienvenue sur AfterWork',
|
'Bienvenue sur AfterWork',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24,
|
fontSize: 26,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Colors.blueAccent,
|
color: Colors.white,
|
||||||
|
shadows: [
|
||||||
|
Shadow(
|
||||||
|
offset: Offset(0, 2),
|
||||||
|
blurRadius: 6,
|
||||||
|
color: Colors.black26,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 40),
|
const SizedBox(height: 40),
|
||||||
|
// Champ Email
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: const InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Email',
|
labelText: 'Email',
|
||||||
border: OutlineInputBorder(),
|
filled: true,
|
||||||
prefixIcon: Icon(Icons.email),
|
fillColor: Colors.white.withOpacity(0.1),
|
||||||
|
labelStyle: const TextStyle(color: Colors.white),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
borderSide: BorderSide.none,
|
||||||
|
),
|
||||||
|
prefixIcon: const Icon(Icons.email, color: Colors.white),
|
||||||
),
|
),
|
||||||
keyboardType: TextInputType.emailAddress,
|
keyboardType: TextInputType.emailAddress,
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
return 'Veuillez entrer votre email';
|
return 'Veuillez entrer votre email';
|
||||||
@@ -112,19 +166,28 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
// Champ Mot de passe
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Mot de passe',
|
labelText: 'Mot de passe',
|
||||||
border: const OutlineInputBorder(),
|
filled: true,
|
||||||
prefixIcon: const Icon(Icons.lock),
|
fillColor: Colors.white.withOpacity(0.1),
|
||||||
|
labelStyle: const TextStyle(color: Colors.white),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
borderSide: BorderSide.none,
|
||||||
|
),
|
||||||
|
prefixIcon: const Icon(Icons.lock, color: Colors.white),
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
_isPasswordVisible ? Icons.visibility : Icons.visibility_off,
|
_isPasswordVisible ? Icons.visibility : Icons.visibility_off,
|
||||||
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
onPressed: _togglePasswordVisibility,
|
onPressed: _togglePasswordVisibility,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
obscureText: !_isPasswordVisible,
|
obscureText: !_isPasswordVisible,
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
return 'Veuillez entrer votre mot de passe';
|
return 'Veuillez entrer votre mot de passe';
|
||||||
@@ -139,29 +202,33 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
// Bouton de connexion avec animation de soumission
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
textStyle: const TextStyle(fontSize: 18),
|
textStyle: const TextStyle(fontSize: 18),
|
||||||
backgroundColor: Colors.blueAccent,
|
backgroundColor: _isSubmitting ? Colors.grey : Colors.blueAccent,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onPressed: _submit,
|
onPressed: _isSubmitting ? null : _submit,
|
||||||
child: const Text('Connexion'),
|
child: _isSubmitting
|
||||||
|
? const CircularProgressIndicator(color: Colors.white)
|
||||||
|
: const Text('Connexion'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
// Lien pour s'inscrire
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Naviguer vers la page d'inscription
|
// Naviguer vers la page d'inscription
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'Pas encore de compte ? Inscrivez-vous',
|
'Pas encore de compte ? Inscrivez-vous',
|
||||||
style: TextStyle(color: Colors.blueAccent),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
54
lib/presentation/screens/story/story_screen.dart
Normal file
54
lib/presentation/screens/story/story_screen.dart
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class StoryScreen extends StatelessWidget {
|
||||||
|
const StoryScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Créer une Story'),
|
||||||
|
backgroundColor: Colors.blueAccent,
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'Texte de la Story',
|
||||||
|
style: TextStyle(fontSize: 18, color: Colors.white),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
TextField(
|
||||||
|
maxLines: 5,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Rédigez votre Story',
|
||||||
|
filled: true,
|
||||||
|
fillColor: Colors.white.withOpacity(0.1),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
borderSide: BorderSide.none,
|
||||||
|
),
|
||||||
|
hintStyle: const TextStyle(color: Colors.white70),
|
||||||
|
),
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
// Logique pour créer la story
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.blueAccent,
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
),
|
||||||
|
child: const Text('Publier la Story'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
0
lib/presentation/state_management/event_bloc.dart
Normal file
0
lib/presentation/state_management/event_bloc.dart
Normal file
0
lib/presentation/state_management/payment_bloc.dart
Normal file
0
lib/presentation/state_management/payment_bloc.dart
Normal file
30
lib/presentation/widgets/custom_appbar.dart
Normal file
30
lib/presentation/widgets/custom_appbar.dart
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||||
|
final String title;
|
||||||
|
final List<Widget> actions;
|
||||||
|
|
||||||
|
const CustomAppBar({
|
||||||
|
Key? key,
|
||||||
|
required this.title,
|
||||||
|
this.actions = const [],
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppBar(
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
title: Text(
|
||||||
|
title,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: actions,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Size get preferredSize => const Size.fromHeight(56.0);
|
||||||
|
}
|
||||||
@@ -4,14 +4,25 @@ class CustomButton extends StatelessWidget {
|
|||||||
final String text;
|
final String text;
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
|
|
||||||
const CustomButton({super.key, required this.text, required this.onPressed});
|
const CustomButton({
|
||||||
|
Key? key,
|
||||||
|
required this.text,
|
||||||
|
required this.onPressed,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
|
textStyle: const TextStyle(fontSize: 18),
|
||||||
|
backgroundColor: Colors.blueAccent,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Text(text),
|
child: Text(text),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
47
lib/presentation/widgets/custom_drawer.dart
Normal file
47
lib/presentation/widgets/custom_drawer.dart
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CustomDrawer extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Drawer(
|
||||||
|
child: ListView(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
children: <Widget>[
|
||||||
|
DrawerHeader(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.blueAccent,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'AfterWork',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 24,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.home),
|
||||||
|
title: Text('Accueil'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushNamed(context, '/home');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.event),
|
||||||
|
title: Text('Événements'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushNamed(context, '/event');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(Icons.camera_alt), // Icône mise à jour pour la story
|
||||||
|
title: Text('Story'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushNamed(context, '/story');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user