Compare commits
2 Commits
2a9918d755
...
584a725fe0
Author | SHA1 | Date | |
---|---|---|---|
584a725fe0 | |||
64a1d56e2f |
31
em2rp/.vscode/launch.json
vendored
31
em2rp/.vscode/launch.json
vendored
@ -3,21 +3,22 @@
|
|||||||
// Hover to view descriptions of existing attributes.
|
// Hover to view descriptions of existing attributes.
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
|
||||||
"name": "Launch Edge",
|
{
|
||||||
"request": "launch",
|
"name": "Launch Edge",
|
||||||
"type": "msedge",
|
"request": "launch",
|
||||||
"url": "http://localhost:8080",
|
"type": "msedge",
|
||||||
"webRoot": "${workspaceFolder}"
|
"url": "http://localhost:8080",
|
||||||
},
|
"webRoot": "${workspaceFolder}"
|
||||||
{
|
},
|
||||||
"name": "Attach to Edge",
|
{
|
||||||
"port": 9222,
|
"name": "Attach to Edge",
|
||||||
"request": "attach",
|
"port": 9222,
|
||||||
"type": "msedge",
|
"request": "attach",
|
||||||
"webRoot": "${workspaceFolder}"
|
"type": "msedge",
|
||||||
},
|
"webRoot": "${workspaceFolder}"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "em2rp",
|
"name": "em2rp",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
BIN
em2rp/assets/EM2_NsurB.jpg
Normal file
BIN
em2rp/assets/EM2_NsurB.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
1
em2rp/assets/Google__G__logo.svg
Normal file
1
em2rp/assets/Google__G__logo.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/><path d="M1 1h22v22H1z" fill="none"/></svg>
|
After Width: | Height: | Size: 742 B |
BIN
em2rp/assets/google.png
Normal file
BIN
em2rp/assets/google.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
em2rp/assets/images/tshirt-incrust.webp
Normal file
BIN
em2rp/assets/images/tshirt-incrust.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
@ -42,11 +42,12 @@ class DefaultFirebaseOptions {
|
|||||||
|
|
||||||
static const FirebaseOptions web = FirebaseOptions(
|
static const FirebaseOptions web = FirebaseOptions(
|
||||||
apiKey: 'AIzaSyARQL4P-t5l-cNjQNP9cMokQrLJ8BorF0U',
|
apiKey: 'AIzaSyARQL4P-t5l-cNjQNP9cMokQrLJ8BorF0U',
|
||||||
appId: '1:341201262902:web:bb70b5ff45df80935a3b97',
|
appId: '1:341201262902:web:c9f26c7729df8e915a3b97',
|
||||||
messagingSenderId: '341201262902',
|
messagingSenderId: '341201262902',
|
||||||
projectId: 'em2rp-951dc',
|
projectId: 'em2rp-951dc',
|
||||||
authDomain: 'em2rp-951dc.firebaseapp.com',
|
authDomain: 'em2rp-951dc.firebaseapp.com',
|
||||||
databaseURL: 'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
databaseURL:
|
||||||
|
'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
||||||
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -55,7 +56,8 @@ class DefaultFirebaseOptions {
|
|||||||
appId: '1:341201262902:android:8c9a9e340ecb58665a3b97',
|
appId: '1:341201262902:android:8c9a9e340ecb58665a3b97',
|
||||||
messagingSenderId: '341201262902',
|
messagingSenderId: '341201262902',
|
||||||
projectId: 'em2rp-951dc',
|
projectId: 'em2rp-951dc',
|
||||||
databaseURL: 'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
databaseURL:
|
||||||
|
'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
||||||
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -64,10 +66,13 @@ class DefaultFirebaseOptions {
|
|||||||
appId: '1:341201262902:ios:767281c23dd9e76a5a3b97',
|
appId: '1:341201262902:ios:767281c23dd9e76a5a3b97',
|
||||||
messagingSenderId: '341201262902',
|
messagingSenderId: '341201262902',
|
||||||
projectId: 'em2rp-951dc',
|
projectId: 'em2rp-951dc',
|
||||||
databaseURL: 'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
databaseURL:
|
||||||
|
'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
||||||
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
||||||
androidClientId: '341201262902-opnuh9ri7ao77qlhebjhshsavplb7vsl.apps.googleusercontent.com',
|
androidClientId:
|
||||||
iosClientId: '341201262902-22rdtoljpgk65lj76bqbk52v861d9lt0.apps.googleusercontent.com',
|
'341201262902-opnuh9ri7ao77qlhebjhshsavplb7vsl.apps.googleusercontent.com',
|
||||||
|
iosClientId:
|
||||||
|
'341201262902-22rdtoljpgk65lj76bqbk52v861d9lt0.apps.googleusercontent.com',
|
||||||
iosBundleId: 'com.em2.erp',
|
iosBundleId: 'com.em2.erp',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -76,10 +81,13 @@ class DefaultFirebaseOptions {
|
|||||||
appId: '1:341201262902:ios:767281c23dd9e76a5a3b97',
|
appId: '1:341201262902:ios:767281c23dd9e76a5a3b97',
|
||||||
messagingSenderId: '341201262902',
|
messagingSenderId: '341201262902',
|
||||||
projectId: 'em2rp-951dc',
|
projectId: 'em2rp-951dc',
|
||||||
databaseURL: 'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
databaseURL:
|
||||||
|
'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
||||||
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
||||||
androidClientId: '341201262902-opnuh9ri7ao77qlhebjhshsavplb7vsl.apps.googleusercontent.com',
|
androidClientId:
|
||||||
iosClientId: '341201262902-22rdtoljpgk65lj76bqbk52v861d9lt0.apps.googleusercontent.com',
|
'341201262902-opnuh9ri7ao77qlhebjhshsavplb7vsl.apps.googleusercontent.com',
|
||||||
|
iosClientId:
|
||||||
|
'341201262902-22rdtoljpgk65lj76bqbk52v861d9lt0.apps.googleusercontent.com',
|
||||||
iosBundleId: 'com.em2.erp',
|
iosBundleId: 'com.em2.erp',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -89,7 +97,8 @@ class DefaultFirebaseOptions {
|
|||||||
messagingSenderId: '341201262902',
|
messagingSenderId: '341201262902',
|
||||||
projectId: 'em2rp-951dc',
|
projectId: 'em2rp-951dc',
|
||||||
authDomain: 'em2rp-951dc.firebaseapp.com',
|
authDomain: 'em2rp-951dc.firebaseapp.com',
|
||||||
databaseURL: 'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
databaseURL:
|
||||||
|
'https://em2rp-951dc-default-rtdb.europe-west1.firebasedatabase.app',
|
||||||
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
storageBucket: 'em2rp-951dc.firebasestorage.app',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,66 @@
|
|||||||
|
import 'package:em2rp/views/calendar_page.dart';
|
||||||
|
import 'package:em2rp/views/login_page.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'firebase_options.dart';
|
import 'firebase_options.dart';
|
||||||
|
import 'utils/colors.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
.ensureInitialized(); // Assure que Flutter est initialisé
|
|
||||||
await Firebase.initializeApp(
|
await Firebase.initializeApp(
|
||||||
options:
|
options: DefaultFirebaseOptions.currentPlatform,
|
||||||
DefaultFirebaseOptions.currentPlatform, // Utilise firebase_options.dart
|
|
||||||
);
|
);
|
||||||
runApp(const MainApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MainApp({super.key});
|
const MyApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const MaterialApp(
|
return MaterialApp(
|
||||||
home: Scaffold(
|
title: 'EM2 ERP',
|
||||||
body: Center(
|
initialRoute: '/',
|
||||||
child: Text('Hello World!'),
|
routes: {
|
||||||
|
'/': (context) =>
|
||||||
|
LoginPage(), // Remplacez HomePage par votre page d'accueil
|
||||||
|
'/calendar': (context) =>
|
||||||
|
CalendarPage(), // Ajoutez cette ligne pour la route /calendar
|
||||||
|
},
|
||||||
|
theme: ThemeData(
|
||||||
|
primarySwatch: Colors.red,
|
||||||
|
primaryColor: AppColors.noir,
|
||||||
|
colorScheme:
|
||||||
|
ColorScheme.fromSwatch().copyWith(secondary: AppColors.rouge),
|
||||||
|
textTheme: const TextTheme(
|
||||||
|
bodyMedium: TextStyle(color: AppColors.noir),
|
||||||
|
),
|
||||||
|
// Personnalisation de l'InputDecorationTheme pour les text fields
|
||||||
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
// Bordure lorsqu'il est focus
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: AppColors.noir), // Couleur rouge quand focus
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
// Bordure par défaut (non focus)
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: AppColors.gris), // Couleur grise par défaut
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(color: AppColors.noir), // Couleur du label
|
||||||
|
hintStyle: TextStyle(color: AppColors.gris), // Couleur du hint text
|
||||||
|
// Tu peux personnaliser d'autres propriétés ici :
|
||||||
|
// fillColor, filled, iconColor, prefixStyle, suffixStyle, etc.
|
||||||
|
),
|
||||||
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
foregroundColor:
|
||||||
|
AppColors.blanc, // Couleur du texte du bouton (ici blanc)
|
||||||
|
backgroundColor: AppColors
|
||||||
|
.noir, // Couleur de fond du bouton (si tu veux aussi changer le fond)
|
||||||
|
// Autres styles possibles pour les boutons :
|
||||||
|
// textStyle, padding, shape, elevation, etc.
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
8
em2rp/lib/utils/colors.dart
Normal file
8
em2rp/lib/utils/colors.dart
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AppColors {
|
||||||
|
static const Color noir = Color(0xFF000000); // Noir
|
||||||
|
static const Color blanc = Color(0xFFFFFFFF); // Blanc
|
||||||
|
static const Color rouge = Color(0xFFFF0000); // Rouge
|
||||||
|
static const Color gris = Color(0xFF808080); // Gris (gris moyen)
|
||||||
|
}
|
22
em2rp/lib/views/calendar_page.dart
Normal file
22
em2rp/lib/views/calendar_page.dart
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
|
||||||
|
class CalendarPage extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final User? user = FirebaseAuth.instance.currentUser;
|
||||||
|
final String email = user?.email ?? 'Guest';
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('Calendar Page'),
|
||||||
|
),
|
||||||
|
body: Center(
|
||||||
|
child: Text(
|
||||||
|
'Hello $email, welcome to EM2RP',
|
||||||
|
style: TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
153
em2rp/lib/views/login_page.dart
Normal file
153
em2rp/lib/views/login_page.dart
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
import 'package:em2rp/views/widgets/auth/mail_textfield.dart';
|
||||||
|
import 'package:em2rp/views/widgets/error_message.dart';
|
||||||
|
import 'package:em2rp/views/widgets/auth/forgot_password_button.dart';
|
||||||
|
import 'package:em2rp/views/widgets/image/big_image_left.dart';
|
||||||
|
import 'package:em2rp/views/widgets/auth/login_button.dart';
|
||||||
|
import 'package:em2rp/views/widgets/image/em2_logo_n_sur_b.dart';
|
||||||
|
import 'package:em2rp/views/widgets/auth/password_textfield.dart';
|
||||||
|
import 'package:em2rp/views/widgets/auth/welcome_text.dart';
|
||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LoginPage extends StatefulWidget {
|
||||||
|
const LoginPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LoginPage> createState() => _LoginPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LoginPageState extends State<LoginPage> {
|
||||||
|
final _emailController = TextEditingController();
|
||||||
|
final _passwordController = TextEditingController();
|
||||||
|
String _errorMessage = '';
|
||||||
|
bool _isLoading = false;
|
||||||
|
bool _obscurePassword = true;
|
||||||
|
bool _highlightPasswordField = false;
|
||||||
|
bool _highlightEmailField = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_emailController.dispose();
|
||||||
|
_passwordController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _signInWithEmailAndPassword() async {
|
||||||
|
setState(() {
|
||||||
|
_errorMessage = '';
|
||||||
|
_isLoading = true;
|
||||||
|
_highlightPasswordField = false;
|
||||||
|
_highlightEmailField = false;
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
await FirebaseAuth.instance.signInWithEmailAndPassword(
|
||||||
|
email: _emailController.text.trim(),
|
||||||
|
password: _passwordController.text,
|
||||||
|
);
|
||||||
|
Navigator.of(context).pushReplacementNamed('/calendar');
|
||||||
|
print('Connexion réussie!');
|
||||||
|
} on FirebaseAuthException catch (e) {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
if (e.code == 'user-not-found' || e.code == 'wrong-password') {
|
||||||
|
_errorMessage = "Email ou mot de passe incorrect.";
|
||||||
|
_highlightPasswordField = true;
|
||||||
|
_highlightEmailField = true;
|
||||||
|
} else if (e.code == 'invalid-email') {
|
||||||
|
_errorMessage = "Adresse email invalide.";
|
||||||
|
_highlightEmailField = true;
|
||||||
|
} else {
|
||||||
|
_errorMessage = "Erreur de connexion. Veuillez réessayer.";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
print('Erreur de connexion: ${e.code} - ${e.message}');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _togglePasswordVisibility() {
|
||||||
|
setState(() {
|
||||||
|
_obscurePassword = !_obscurePassword;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _forgotPassword() {
|
||||||
|
// TODO: Implémenter la logique de mot de passe oublié
|
||||||
|
print("Mot de passe oublié cliqué !");
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
if (constraints.maxWidth > 900) {
|
||||||
|
return _buildLargeScreenLayout(context);
|
||||||
|
} else {
|
||||||
|
return _buildSmallScreenLayout(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildLargeScreenLayout(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
flex: 6,
|
||||||
|
child:
|
||||||
|
const ImageSectionWidget(), // Utilise le composant ImageSection
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 50.0, vertical: 30.0),
|
||||||
|
child: _buildLoginForm(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildSmallScreenLayout(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: _buildLoginForm(context),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildLoginForm(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: <Widget>[
|
||||||
|
const LogoWidget(), // Utilise le widget LogoWidget
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
const WelcomeTextWidget(), // Utilise le widget WelcomeTextWidget
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
EmailTextFieldWidget(
|
||||||
|
emailController: _emailController,
|
||||||
|
highlightEmailField: _highlightEmailField,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
PasswordTextFieldWidget(
|
||||||
|
passwordController: _passwordController,
|
||||||
|
obscurePassword: _obscurePassword,
|
||||||
|
highlightPasswordField: _highlightPasswordField,
|
||||||
|
onTogglePasswordVisibility: _togglePasswordVisibility,
|
||||||
|
),
|
||||||
|
ForgotPasswordButtonWidget(onPressed: _forgotPassword),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
LoginButtonWidget(
|
||||||
|
isLoading: _isLoading,
|
||||||
|
onPressed: _signInWithEmailAndPassword,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
ErrorMessageWidget(errorMessage: _errorMessage),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
21
em2rp/lib/views/widgets/auth/forgot_password_button.dart
Normal file
21
em2rp/lib/views/widgets/auth/forgot_password_button.dart
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ForgotPasswordButtonWidget extends StatelessWidget {
|
||||||
|
final VoidCallback onPressed;
|
||||||
|
|
||||||
|
const ForgotPasswordButtonWidget({super.key, required this.onPressed});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: onPressed,
|
||||||
|
child: const Text(
|
||||||
|
'Mot de passe oublié ?',
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
29
em2rp/lib/views/widgets/auth/login_button.dart
Normal file
29
em2rp/lib/views/widgets/auth/login_button.dart
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import 'package:em2rp/utils/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LoginButtonWidget extends StatelessWidget {
|
||||||
|
final bool isLoading;
|
||||||
|
final VoidCallback onPressed;
|
||||||
|
|
||||||
|
const LoginButtonWidget({
|
||||||
|
super.key,
|
||||||
|
required this.isLoading,
|
||||||
|
required this.onPressed,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ElevatedButton(
|
||||||
|
onPressed: isLoading ? null : onPressed,
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||||
|
textStyle: const TextStyle(fontSize: 18),
|
||||||
|
),
|
||||||
|
child: isLoading
|
||||||
|
? const CircularProgressIndicator(
|
||||||
|
color: AppColors.blanc,
|
||||||
|
)
|
||||||
|
: const Text('Se connecter'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
31
em2rp/lib/views/widgets/auth/mail_textfield.dart
Normal file
31
em2rp/lib/views/widgets/auth/mail_textfield.dart
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:em2rp/utils/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class EmailTextFieldWidget extends StatelessWidget {
|
||||||
|
final TextEditingController emailController;
|
||||||
|
final bool highlightEmailField;
|
||||||
|
|
||||||
|
const EmailTextFieldWidget({
|
||||||
|
super.key,
|
||||||
|
required this.emailController,
|
||||||
|
required this.highlightEmailField,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return TextField(
|
||||||
|
controller: emailController,
|
||||||
|
keyboardType: TextInputType.emailAddress,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'Email',
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderSide: highlightEmailField
|
||||||
|
? const BorderSide(color: Colors.red)
|
||||||
|
: const BorderSide(),
|
||||||
|
),
|
||||||
|
filled: true,
|
||||||
|
fillColor: AppColors.blanc,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
43
em2rp/lib/views/widgets/auth/password_textfield.dart
Normal file
43
em2rp/lib/views/widgets/auth/password_textfield.dart
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import 'package:em2rp/utils/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:em2rp/utils/colors.dart';
|
||||||
|
|
||||||
|
class PasswordTextFieldWidget extends StatelessWidget {
|
||||||
|
final TextEditingController passwordController;
|
||||||
|
final bool obscurePassword;
|
||||||
|
final bool highlightPasswordField;
|
||||||
|
final VoidCallback onTogglePasswordVisibility;
|
||||||
|
|
||||||
|
const PasswordTextFieldWidget({
|
||||||
|
super.key,
|
||||||
|
required this.passwordController,
|
||||||
|
required this.obscurePassword,
|
||||||
|
required this.highlightPasswordField,
|
||||||
|
required this.onTogglePasswordVisibility,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return TextField(
|
||||||
|
controller: passwordController,
|
||||||
|
obscureText: obscurePassword,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'Mot de passe',
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderSide: highlightPasswordField
|
||||||
|
? const BorderSide(color: Colors.red)
|
||||||
|
: const BorderSide(),
|
||||||
|
),
|
||||||
|
filled: true,
|
||||||
|
fillColor: AppColors.blanc,
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
obscurePassword ? Icons.visibility_off : Icons.visibility,
|
||||||
|
color: AppColors.gris,
|
||||||
|
),
|
||||||
|
onPressed: onTogglePasswordVisibility,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
16
em2rp/lib/views/widgets/auth/welcome_text.dart
Normal file
16
em2rp/lib/views/widgets/auth/welcome_text.dart
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import 'package:em2rp/utils/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class WelcomeTextWidget extends StatelessWidget {
|
||||||
|
const WelcomeTextWidget({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Text(
|
||||||
|
'Bienvenue !',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 28, fontWeight: FontWeight.bold, color: AppColors.noir),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
22
em2rp/lib/views/widgets/error_message.dart
Normal file
22
em2rp/lib/views/widgets/error_message.dart
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ErrorMessageWidget extends StatelessWidget {
|
||||||
|
final String errorMessage;
|
||||||
|
|
||||||
|
const ErrorMessageWidget({super.key, required this.errorMessage});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Visibility(
|
||||||
|
visible: errorMessage.isNotEmpty,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 20.0),
|
||||||
|
child: Text(
|
||||||
|
errorMessage,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
23
em2rp/lib/views/widgets/image/big_image_left.dart
Normal file
23
em2rp/lib/views/widgets/image/big_image_left.dart
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import 'package:em2rp/utils/colors.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ImageSectionWidget extends StatelessWidget {
|
||||||
|
const ImageSectionWidget({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
color: AppColors.gris.withOpacity(0.1),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.zero,
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/tshirt-incrust.webp',
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
height: double.infinity,
|
||||||
|
width: double.infinity,
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
13
em2rp/lib/views/widgets/image/em2_logo_n_sur_b.dart
Normal file
13
em2rp/lib/views/widgets/image/em2_logo_n_sur_b.dart
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LogoWidget extends StatelessWidget {
|
||||||
|
const LogoWidget({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Image.asset(
|
||||||
|
'assets/EM2_NsurB.jpg',
|
||||||
|
height: 100,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -12,11 +12,15 @@ dependencies:
|
|||||||
firebase_core: ^3.12.1
|
firebase_core: ^3.12.1
|
||||||
firebase_auth: ^5.5.1
|
firebase_auth: ^5.5.1
|
||||||
cloud_firestore: ^5.6.5
|
cloud_firestore: ^5.6.5
|
||||||
|
google_sign_in: ^6.2.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^4.0.0
|
flutter_lints: ^5.0.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
assets:
|
||||||
|
- assets/
|
||||||
|
- assets/images/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user