Skip to content

Commit

Permalink
Merge pull request #17 from B3-3iL-DLW/ui/create-login-page
Browse files Browse the repository at this point in the history
UI/create login page related to #17
  • Loading branch information
julesartd authored Mar 8, 2024
2 parents dacca88 + 44173f2 commit 02eca5b
Show file tree
Hide file tree
Showing 16 changed files with 307 additions and 40 deletions.
3 changes: 0 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
// Pointez pour afficher la description des attributs existants.
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
Expand Down
2 changes: 1 addition & 1 deletion frontend/app_student/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ migrate_working_dir/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
Expand Down
Binary file added frontend/app_student/assets/images/3il-logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions frontend/app_student/lib/config/prod_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ import 'config.dart';

class ProdConfig extends Config {
@override
// TODO: Implement the new production API URL
String get apiUrl => 'https://api-dev.lukasvalois.com';

String get apiUrl => 'https://api.lukasvalois.com';
}
6 changes: 6 additions & 0 deletions frontend/app_student/lib/generated/assets.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
///This file is automatically generated. DO NOT EDIT, all your changes would be lost.
class Assets {
Assets._();

static const String images3ilLogo = 'assets/images/3il-logo.jpg';
}
22 changes: 22 additions & 0 deletions frontend/app_student/lib/login/views/login_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:app_student/login/widgets/form/form_login.dart';
import 'package:app_student/login/widgets/header/header_text.dart';
import 'package:flutter/material.dart';

import '../widgets/header/header_logo.dart';

class LoginPage extends StatelessWidget {
const LoginPage({super.key});

@override
Widget build(BuildContext context) {
return const Scaffold(
body: Column(
children: [
HeaderLogo(),
HeaderText("Bonjour :)"),
Expanded(child: FormLogin()),
],
),
);
}
}
41 changes: 41 additions & 0 deletions frontend/app_student/lib/login/widgets/form/button_submit.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';

class SubmitButton extends StatelessWidget {
const SubmitButton({super.key});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 25.0, top: 80.0, right: 25.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: double.infinity,
height: 50.0,
child: ElevatedButton(
style: ButtonStyle(
textStyle: MaterialStateProperty.all<TextStyle>(
const TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
),
),
backgroundColor: MaterialStateProperty.all<Color>(
Theme.of(context).focusColor),
foregroundColor: MaterialStateProperty.all<Color>(Colors.white),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3.0),
),
),
),
onPressed: () {},
child: const Text('Connexion'),
),
),
],
),
);
}
}
24 changes: 24 additions & 0 deletions frontend/app_student/lib/login/widgets/form/form_login.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';

import 'button_submit.dart';
import 'inputs/input_birthdate.dart';
import 'inputs/input_ine.dart';
import 'inputs/input_prenom.dart';

class FormLogin extends StatelessWidget {
const FormLogin({super.key});

@override
Widget build(BuildContext context) {
return const Scaffold(
body: Column(
children: [
INETextField(),
BirthDateField(),
FirstnameTextField(),
SubmitButton()
],
),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import 'package:flutter/material.dart';

class BirthDateField extends StatefulWidget {
const BirthDateField({super.key});

@override
BirthDateFieldState createState() => BirthDateFieldState();
}

class BirthDateFieldState extends State<BirthDateField> {
DateTime _selectedDate = DateTime.now();

Future<void> _selectDate(BuildContext context) async {
final DateTime? picked = await showDatePicker(
context: context,
initialDate: _selectedDate,
firstDate: DateTime(1900),
lastDate: DateTime.now(),
);
if (picked != null && picked != _selectedDate) {
setState(() {
_selectedDate = picked;
});
}
}

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 25.0, top: 30.0, right: 25.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Date de naissance',
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[600],
),
),
const SizedBox(height: 10.0),
TextFormField(
readOnly: true,
decoration: InputDecoration(
hintText: _selectedDate.toLocal().toString().split(' ')[0],
contentPadding:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
border: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(3.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Theme.of(context).focusColor),
borderRadius: BorderRadius.circular(3.0),
),
),
onTap: () => _selectDate(context),
),
],
),
);
}
}
43 changes: 43 additions & 0 deletions frontend/app_student/lib/login/widgets/form/inputs/input_ine.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';

class INETextField extends StatelessWidget {
const INETextField({super.key});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
left: 25.0,
top: 10.0,
right: 25.0), // Ajout d'un padding à gauche, en haut et à droite
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'INE',
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[600],
),
),
const SizedBox(height: 10.0),
TextFormField(
decoration: InputDecoration(
hintText: 'Numéro INE',
contentPadding:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
border: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(3.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Theme.of(context).focusColor),
borderRadius: BorderRadius.circular(3.0),
),
),
),
],
),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';

class FirstnameTextField extends StatelessWidget {
const FirstnameTextField({super.key});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 25.0, top: 30.0, right: 25.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Prénom',
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[600],
),
),
const SizedBox(height: 10.0),
TextFormField(
style: TextStyle(
color: Colors.grey[600],
),
decoration: InputDecoration(
hintText: 'Entrez votre prénom ici',
contentPadding:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(3.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Theme.of(context).focusColor),
borderRadius: BorderRadius.circular(3.0),
),
),
),
],
),
);
}
}
20 changes: 20 additions & 0 deletions frontend/app_student/lib/login/widgets/header/header_logo.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:flutter/cupertino.dart';

class HeaderLogo extends StatelessWidget {
const HeaderLogo({super.key});

@override
Widget build(BuildContext context) {
return Container(
height: 210.0, // Hauteur du Container
color: const Color(0xFF005067),
child: Center(
child: SizedBox(
width: 200.0, // Largeur de l'image
height: 200.0, // Hauteur de l'image
child: Image.asset('images/3il-logo.jpg'),
),
),
);
}
}
28 changes: 28 additions & 0 deletions frontend/app_student/lib/login/widgets/header/header_text.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:flutter/cupertino.dart';

class HeaderText extends StatelessWidget {
final String content;

const HeaderText(this.content, {super.key});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
top: 35.0,
left: 25.0,
bottom: 40), // Ajout d'un espacement à gauche de 10px
child: Align(
alignment: Alignment.centerLeft,
child: Text(
content,
style: const TextStyle(
fontSize: 34.0,
fontFamily: 'Arial',
fontWeight: FontWeight.bold,
),
),
),
);
}
}
25 changes: 8 additions & 17 deletions frontend/app_student/lib/main_dev.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import 'package:app_student/api/api_service.dart';
import 'package:app_student/api/classes/repositories/class_repository.dart';
import 'package:app_student/classes/views/class.dart';
import 'package:app_student/config/dev_config.dart';
import 'package:app_student/login/views/login_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'classes/bloc/class_bloc.dart';

import 'config/config.dart';

void main() {
Expand All @@ -21,19 +19,12 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
final config = Provider.of<Config>(context);
final ApiService apiService = ApiService(apiUrl: config.apiUrl);
final classBloc =
ClassBloc(classRepository: ClassRepository(apiService: apiService));

return MaterialApp(
title: 'Class List',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: ClassListPage(
classBloc: classBloc,
),
);
title: 'Class List',
theme: ThemeData(
primarySwatch: Colors.blue,
focusColor: const Color(0xffE84E0F),
),
home: const LoginPage());
}
}
Loading

0 comments on commit 02eca5b

Please sign in to comment.