First commit

This commit is contained in:
Van Leemput Dayron
2025-09-30 15:53:48 +02:00
commit 807b66f919
145 changed files with 6206 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
class HomeContent extends StatelessWidget {
const HomeContent({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.home, size: 80, color: Colors.blue),
SizedBox(height: 20),
Text(
'Bienvenue sur Travel Mate',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
SizedBox(height: 10),
Text('Page d\'accueil'),
],
),
);
}
}

View File

@@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
class ProfileContent extends StatelessWidget {
const ProfileContent({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(16),
child: Center(
child: Column(
children: [
CircleAvatar(
radius: 50,
backgroundColor: Colors.blue,
child: Icon(Icons.person, size: 50, color: Colors.white),
),
SizedBox(height: 20),
Text(
'Nom d\'utilisateur',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
SizedBox(height: 10),
Text('email@example.com'),
SizedBox(height: 30),
ElevatedButton(onPressed: () {}, child: Text('Modifier le profil')),
],
),
),
);
}
}

View File

@@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'settings_theme_content.dart';
class SettingsContent extends StatelessWidget {
const SettingsContent({super.key});
@override
Widget build(BuildContext context) {
return ListView(
padding: EdgeInsets.all(16),
children: [
Text(
'Paramètres',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
SizedBox(height: 20),
ListTile(
leading: Icon(Icons.palette),
title: Text('Thème'),
subtitle: Text('Clair, sombre ou système'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SettingsThemeContent()),
);
},
),
ListTile(
leading: Icon(Icons.person),
title: Text('Profil'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {},
),
ListTile(
leading: Icon(Icons.notifications),
title: Text('Notifications'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {},
),
ListTile(
leading: Icon(Icons.language),
title: Text('Langue'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {},
),
ListTile(
leading: Icon(Icons.privacy_tip),
title: Text('Confidentialité'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {},
),
],
);
}
}

View File

@@ -0,0 +1,111 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../providers/theme_provider.dart';
class SettingsThemeContent extends StatelessWidget {
const SettingsThemeContent({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Thème'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: Consumer<ThemeProvider>(
builder: (context, themeProvider, child) {
return ListView(
padding: EdgeInsets.all(16),
children: [
Text(
'Choisir le thème',
style: Theme.of(context).textTheme.headlineSmall,
),
SizedBox(height: 20),
// Option Système
RadioListTile<ThemeMode>(
title: Text('Système'),
subtitle: Text('Suit les paramètres de votre appareil'),
value: ThemeMode.system,
groupValue: themeProvider.themeMode,
onChanged: (ThemeMode? value) {
if (value != null) {
themeProvider.setThemeMode(value);
}
},
secondary: Icon(Icons.brightness_auto),
),
// Option Clair
RadioListTile<ThemeMode>(
title: Text('Clair'),
subtitle: Text('Thème clair en permanence'),
value: ThemeMode.light,
groupValue: themeProvider.themeMode,
onChanged: (ThemeMode? value) {
if (value != null) {
themeProvider.setThemeMode(value);
}
},
secondary: Icon(Icons.light_mode),
),
// Option Sombre
RadioListTile<ThemeMode>(
title: Text('Sombre'),
subtitle: Text('Thème sombre en permanence'),
value: ThemeMode.dark,
groupValue: themeProvider.themeMode,
onChanged: (ThemeMode? value) {
if (value != null) {
themeProvider.setThemeMode(value);
}
},
secondary: Icon(Icons.dark_mode),
),
SizedBox(height: 30),
// Aperçu du thème actuel
Card(
child: Padding(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Aperçu',
style: Theme.of(context).textTheme.titleMedium,
),
SizedBox(height: 10),
Row(
children: [
Icon(
themeProvider.isDarkMode
? Icons.dark_mode
: Icons.light_mode,
color: Theme.of(context).colorScheme.primary,
),
SizedBox(width: 10),
Text(
themeProvider.isDarkMode
? 'Mode sombre actif'
: 'Mode clair actif',
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
),
),
],
),
],
),
),
),
],
);
},
),
);
}
}

59
lib/main.dart Normal file
View File

@@ -0,0 +1,59 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:travel_mate/pages/resetpswd.dart';
import 'package:travel_mate/pages/signup.dart';
import 'pages/login.dart';
import 'pages/home.dart';
import 'providers/theme_provider.dart';
void main() {
runApp(
ChangeNotifierProvider(
create: (context) => ThemeProvider(),
child: const MyApp(),
),
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return Consumer<ThemeProvider>(
builder: (context, themeProvider, child) {
return MaterialApp(
title: 'Travel Mate',
themeMode: themeProvider.themeMode,
// Thème clair
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 180, 180, 180),
brightness: Brightness.light,
),
useMaterial3: true,
),
// Thème sombre
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 43, 43, 43),
brightness: Brightness.dark,
),
useMaterial3: true,
),
initialRoute: '/login',
routes: {
'/login': (context) => const LoginPage(),
'/signup': (context) => const SignUpPage(),
'/home': (context) => const HomePage(),
'/forgot': (context) => const ForgotPasswordPage(),
},
debugShowCheckedModeBanner: false,
);
},
);
}
}

99
lib/pages/home.dart Normal file
View File

@@ -0,0 +1,99 @@
import 'package:flutter/material.dart';
import '../components/home/home_content.dart';
import '../components/settings/settings_content.dart';
import '../components/profile/profile_content.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
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
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(_titles[_currentIndex]),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
foregroundColor: Colors.white,
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.inversePrimary,
),
child: Text(
"Travel Mate",
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
ListTile(
leading: Icon(Icons.home),
title: Text("Accueil"),
selected: _currentIndex == 0,
onTap: () {
setState(() {
_currentIndex = 0;
});
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.settings),
title: Text("Paramètres"),
selected: _currentIndex == 1,
onTap: () {
setState(() {
_currentIndex = 1;
});
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.person),
title: Text("Profil"),
selected: _currentIndex == 2,
onTap: () {
setState(() {
_currentIndex = 2;
});
Navigator.pop(context);
},
),
Divider(),
ListTile(
leading: Icon(Icons.logout, color: Colors.red),
title: Text("Déconnexion", style: TextStyle(color: Colors.red)),
onTap: () {
Navigator.pop(context);
Navigator.pushNamedAndRemoveUntil(
context,
'/login',
(route) => false,
);
},
),
],
),
),
body: _pages[_currentIndex],
);
}
}

211
lib/pages/login.dart Normal file
View File

@@ -0,0 +1,211 @@
//import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
class LoginPage extends StatelessWidget {
const LoginPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
children: [
const SizedBox(height: 40),
const Text(
'Bienvenue sur Travel Mate',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
const SizedBox(height: 12),
const Text(
'Connectez-vous pour continuer',
style: TextStyle(fontSize: 16, color: Colors.grey),
),
const SizedBox(height: 80),
const TextField(
decoration: InputDecoration(
labelText: 'Email',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
),
const SizedBox(height: 20),
const TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Logique de connexion
Navigator.pushReplacementNamed(context, '/home');
},
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: const Text('Login', style: TextStyle(fontSize: 18)),
),
const SizedBox(height: 20),
TextButton(
onPressed: () {
Navigator.pushNamed(context, '/forgot');
},
child: const Text('Mot de passe oublié ?'),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Pas encore inscrit ? "),
GestureDetector(
onTap: () {
// Logique d'inscription
Navigator.pushNamed(context, '/signup');
},
child: const Text(
'Inscrivez-vous !',
style: TextStyle(
color: Color.fromARGB(255, 37, 109, 167),
decoration: TextDecoration.underline,
),
),
),
],
),
const SizedBox(height: 40),
Container(
width: double.infinity,
height: 1,
color: Colors.grey.shade300,
),
const SizedBox(height: 40),
Text(
'Ou connectez-vous avec',
style: TextStyle(color: Colors.grey.shade600),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
// Bouton Google avec fond
GestureDetector(
onTap: () {
// Logique de connexion avec Google
},
child: Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: Colors.black,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.3),
spreadRadius: 1,
blurRadius: 3,
offset: Offset(0, 1),
),
],
border: Border.all(
color: Colors.grey.shade300,
width: 1,
),
),
child: Center(
child: Image.asset(
'assets/icons/google.png',
width: 24,
height: 24,
),
),
),
),
const SizedBox(height: 8),
const Text('Google'),
],
),
const SizedBox(width: 40),
Column(
children: [
// APPLE
GestureDetector(
onTap: () {
// Logique de connexion avec Google
},
child: Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: Colors.black,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.3),
spreadRadius: 1,
blurRadius: 3,
offset: Offset(0, 1),
),
],
border: Border.all(
color: Colors.grey.shade300,
width: 1,
),
),
child: Center(
child: Image.asset(
'assets/icons/apple_white.png',
width: 24,
height: 24,
),
),
),
),
const SizedBox(height: 8),
const Text('Apple'),
],
),
],
),
],
),
),
),
),
);
}
}

106
lib/pages/resetpswd.dart Normal file
View File

@@ -0,0 +1,106 @@
import 'package:flutter/material.dart';
class ForgotPasswordPage extends StatelessWidget {
const ForgotPasswordPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
backgroundColor: Colors.transparent,
elevation: 0,
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
children: [
const Text(
"Travel Mate",
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
const SizedBox(height: 24),
const Text(
"Vous avez oublié votre mot de passe ? \n Ne vous inquiétez pas vous pouvez le réinitaliser !",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
),
const SizedBox(height: 40),
const Text(
"Quel est votre email ? \n Si celui-ci existe dans note base de donées, nous vous enverrons un mail avec un mot de passe unique.",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
),
const SizedBox(height: 24),
const TextField(
decoration: InputDecoration(
labelText: 'example@travelmate.com',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
),
const SizedBox(height: 40),
ElevatedButton(
onPressed: () {
// Logique de connexion
},
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: const Text('Envoyer', style: TextStyle(fontSize: 18)),
),
const SizedBox(height: 20),
Container(
width: double.infinity,
height: 1,
color: Colors.grey.shade300,
),
const SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Pas encore inscrit ? "),
GestureDetector(
onTap: () {
// Go to sign up page
Navigator.pushNamed(context, '/signup');
},
child: const Text(
'Inscrivez-vous !',
style: TextStyle(
color: Color.fromARGB(255, 37, 109, 167),
decoration: TextDecoration.underline,
),
),
),
],
),
],
),
),
),
),
);
}
}

246
lib/pages/signup.dart Normal file
View File

@@ -0,0 +1,246 @@
import 'package:flutter/material.dart';
class SignUpPage extends StatelessWidget {
const SignUpPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
backgroundColor: Colors.transparent,
elevation: 0,
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Center(
child: Column(
children: [
const Text(
'Bienvenue sur Travel Mate',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
const SizedBox(height: 12),
const Text(
'Créez un compte pour continuer',
style: TextStyle(fontSize: 16, color: Colors.grey),
),
const SizedBox(height: 20),
const TextField(
decoration: InputDecoration(
labelText: 'Nom',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
),
const SizedBox(height: 12),
const TextField(
decoration: InputDecoration(
labelText: 'Prénom',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
),
const SizedBox(height: 20),
const TextField(
decoration: InputDecoration(
labelText: 'Email',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
),
const SizedBox(height: 20),
const TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Mot de passe',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
),
const SizedBox(height: 20),
const TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Confirmez le mot de passe',
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Logique d'inscription
Navigator.pushNamed(context, '/home');
},
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(50),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: const Text(
'S\'inscrire',
style: TextStyle(fontSize: 18),
),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text("Déjà un compte ? "),
GestureDetector(
onTap: () {
// Logique de navigation vers la page de connexion
Navigator.pop(context);
},
child: const Text(
'Connectez-vous !',
style: TextStyle(
color: Colors.blue,
fontWeight: FontWeight.bold,
),
),
),
],
),
const SizedBox(height: 40),
Container(
width: double.infinity,
height: 1,
color: Colors.grey.shade300,
),
const SizedBox(height: 40),
Text(
'Ou inscrivez-vous avec',
style: TextStyle(color: Colors.grey.shade600),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
// Bouton Google avec fond
GestureDetector(
onTap: () {
// Logique de connexion avec Google
},
child: Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: Colors.black,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.3),
spreadRadius: 1,
blurRadius: 3,
offset: Offset(0, 1),
),
],
border: Border.all(
color: Colors.grey.shade300,
width: 1,
),
),
child: Center(
child: Image.asset(
'assets/icons/google.png',
width: 24,
height: 24,
),
),
),
),
const SizedBox(height: 8),
const Text('Google'),
],
),
const SizedBox(width: 40),
Column(
children: [
// APPLE
GestureDetector(
onTap: () {
// Logique de connexion avec Google
},
child: Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: Colors.black,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.grey.withValues(alpha: 0.3),
spreadRadius: 1,
blurRadius: 3,
offset: Offset(0, 1),
),
],
border: Border.all(
color: Colors.grey.shade300,
width: 1,
),
),
child: Center(
child: Image.asset(
'assets/icons/apple_white.png',
width: 24,
height: 24,
),
),
),
),
const SizedBox(height: 8),
const Text('Apple'),
],
),
],
),
],
),
),
),
),
);
}
}

View File

@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
class ThemeProvider extends ChangeNotifier {
ThemeMode _themeMode = ThemeMode.system;
ThemeMode get themeMode => _themeMode;
bool get isDarkMode {
if (_themeMode == ThemeMode.system) {
return WidgetsBinding.instance.window.platformBrightness ==
Brightness.dark;
}
return _themeMode == ThemeMode.dark;
}
ThemeProvider() {
_loadThemeMode();
}
void setThemeMode(ThemeMode themeMode) async {
_themeMode = themeMode;
notifyListeners();
// Sauvegarder la préférence
final prefs = await SharedPreferences.getInstance();
await prefs.setString('themeMode', themeMode.toString());
}
void _loadThemeMode() async {
final prefs = await SharedPreferences.getInstance();
final themeModeString = prefs.getString('themeMode');
if (themeModeString != null) {
switch (themeModeString) {
case 'ThemeMode.light':
_themeMode = ThemeMode.light;
break;
case 'ThemeMode.dark':
_themeMode = ThemeMode.dark;
break;
case 'ThemeMode.system':
default:
_themeMode = ThemeMode.system;
break;
}
notifyListeners();
}
}
}