Skip to content

Commit

Permalink
Merge pull request #23 from FeloxleF/felix-calendrier
Browse files Browse the repository at this point in the history
Felix calendrier
  • Loading branch information
FeloxleF authored Apr 16, 2024
2 parents fcbdddb + 17530ed commit 64df43a
Show file tree
Hide file tree
Showing 15 changed files with 546 additions and 339 deletions.
332 changes: 223 additions & 109 deletions lib/Screens/Calendar.dart

Large diffs are not rendered by default.

24 changes: 19 additions & 5 deletions lib/Screens/HomeForm.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'package:activmind_app/Screens/Calendar.dart';
import 'package:activmind_app/Screens/appsettingpage.dart';
import 'package:activmind_app/Screens/locationList.dart';
import 'package:activmind_app/Screens/profilepage.dart';
import 'package:activmind_app/Screens/tasklist.dart';
import 'package:activmind_app/common/appandfooterbar.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class HomeForm extends StatefulWidget {
const HomeForm({Key? key}) : super(key: key);
Expand Down Expand Up @@ -49,7 +50,7 @@ class _HomeFormState extends State<HomeForm> {
if (index == 4) {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const AppSettingPage()),
MaterialPageRoute(builder: (context) => const ProfilePage()),
);
return; // Return here to prevent further execution
}
Expand All @@ -61,7 +62,7 @@ class _HomeFormState extends State<HomeForm> {

@override
Widget build(BuildContext context) {
final Widget currentPage;
final Widget currentPage;
switch (_currentIndex) {
case 0:
currentPage = const TaskList();
Expand All @@ -76,14 +77,27 @@ class _HomeFormState extends State<HomeForm> {
currentPage = const LocationList();
break;
case 4:
currentPage = const AppSettingPage();
currentPage = const ProfilePage();
break;
default:
currentPage = const TaskList(); // Default to the first page
}
return Scaffold(
appBar: const MyAppBar(), // Use MyAppBar for header
body: const Text('welcom to ActivMind'),
body: Padding(
padding: const EdgeInsets.all(20),
child: Column(children: <Widget>[
const SizedBox(height: 20),
Center(
child: Text(
"Bienvenue sur Activ'Mind",
style: GoogleFonts.nunito(
fontSize: 25,
fontWeight: FontWeight.w600,
),
)),
]),
),
bottomNavigationBar: BottomNavBar(
currentIndex: _currentIndex,
onTap: _onItemTapped,
Expand Down
36 changes: 22 additions & 14 deletions lib/Screens/appsettingpage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import 'package:activmind_app/Screens/profilepage.dart';
import 'package:activmind_app/Screens/tasklist.dart';
import 'package:activmind_app/common/appandfooterbar.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';

import '../common/globalvariable.dart';

class AppSettingPage extends StatefulWidget {
const AppSettingPage({Key? key}) : super(key: key);
Expand Down Expand Up @@ -38,7 +42,7 @@ class _AppSettingPageState extends State<AppSettingPage> {
);
return; // Return here to prevent further execution
}
if (index == 3) {
if (index == 3) {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const LocationList()),
Expand All @@ -49,7 +53,7 @@ class _AppSettingPageState extends State<AppSettingPage> {
if (index == 4) {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const AppSettingPage()),
MaterialPageRoute(builder: (context) => const ProfilePage()),
);
return; // Return here to prevent further execution
}
Expand All @@ -61,7 +65,8 @@ class _AppSettingPageState extends State<AppSettingPage> {

@override
Widget build(BuildContext context) {
final Widget currentPage;
var globalVariables = Provider.of<GlobalVariables>(context);
final Widget currentPage;
switch (_currentIndex) {
case 0:
currentPage = const TaskList();
Expand All @@ -82,31 +87,34 @@ class _AppSettingPageState extends State<AppSettingPage> {
currentPage = const TaskList(); // Default to the first page
}
return Scaffold(
appBar: const MyAppBar(),

appBar: const MyAppBar(),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const ProfilePage()));
},
Navigator.push(context,
MaterialPageRoute(builder: (_) => const ProfilePage()));
},
child: const Text('Open Profile Page'),
),
),
const SizedBox(height: 20), // Add some space between button and footer
const Text('Welcome to ActivMind'),
const SizedBox(height: 20),
// Add some space between button and footer
Text('Vous êtes sur le profil de ${globalVariables.user ?? ''}',
textAlign: TextAlign.center,
style: GoogleFonts.nunito(
fontSize: 22,
fontWeight: FontWeight.w400,
),
),
],
),

bottomNavigationBar: BottomNavBar(
currentIndex: _currentIndex,
onTap: _onItemTapped,
),
),
);
}
}
53 changes: 34 additions & 19 deletions lib/Screens/createtask.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:convert';
import 'dart:ffi';
import 'package:activmind_app/Screens/Calendar.dart';
import 'package:activmind_app/common/gen_text_form_field.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
Expand Down Expand Up @@ -167,7 +167,7 @@ class _createTaskState extends State<createTask> {
if (form!.validate()) {
SharedPreferences prefs = await SharedPreferences.getInstance();
final token = prefs.getString('token');
final String apiUrl = 'http://10.0.2.2:8000/tasks/${taskData?["id"]}/';
final String apiUrl = 'http://10.0.2.2:8000/tasks/${taskData["id"]}/';
print(apiUrl);
final response = await http.put(
Uri.parse(apiUrl),
Expand Down Expand Up @@ -220,25 +220,26 @@ class _createTaskState extends State<createTask> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 10.0),
const Text(
"Ajouter une tâche",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 25.0),
Text(
"Ajouter une activité",
style: GoogleFonts.nunito(
fontSize: 25,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
const SizedBox(height: 20.0),
GetTextFormField(
controller: _titleController,
icon: Icons.title,
hintName: 'titre*',
hintName: 'Titre*',
inputtype: TextInputType.text,
),
const SizedBox(height: 10.0),
GetTextFormField(
controller: _descriptionController,
icon: Icons.description,
hintName: 'description *',
hintName: 'Description *',
),
const SizedBox(height: 20.0),
Padding(
Expand All @@ -254,7 +255,7 @@ class _createTaskState extends State<createTask> {
builder: (BuildContext context, Widget? child) {
return Theme(
data: ThemeData.light().copyWith(
colorScheme: ColorScheme.light(
colorScheme: const ColorScheme.light(
primary:
Color.fromARGB(255, 107, 109, 174),
),
Expand Down Expand Up @@ -354,7 +355,7 @@ class _createTaskState extends State<createTask> {
),
const SizedBox(height: 5.0),
Container(
padding: const EdgeInsets.all(8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
Checkbox(
Expand All @@ -366,12 +367,17 @@ class _createTaskState extends State<createTask> {
});
},
),
const Text("Alarm"),
Text("Alarm",
style: GoogleFonts.nunito(
fontSize: 15,
fontWeight: FontWeight.w600,
),
),
],
),
),
Container(
padding: const EdgeInsets.all(8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
Checkbox(
Expand All @@ -383,12 +389,17 @@ class _createTaskState extends State<createTask> {
});
},
),
const Text("Repetation"),
Text("Repetition",
style: GoogleFonts.nunito(
fontSize: 15,
fontWeight: FontWeight.w600,
),
),
],
),
),
Container(
padding: const EdgeInsets.all(8),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
Checkbox(
Expand All @@ -400,7 +411,11 @@ class _createTaskState extends State<createTask> {
});
},
),
const Text("Done"),
Text("Terminée",
style: GoogleFonts.nunito(
fontSize: 15,
fontWeight: FontWeight.w600,
),),
],
),
),
Expand All @@ -416,7 +431,7 @@ class _createTaskState extends State<createTask> {
),
onPressed: () =>
selectOperation(operation, taskData),
child: const Text('soumettre'),
child: const Text('Enregistrer'),
),
SizedBox(width: 20),
ElevatedButton(
Expand All @@ -435,7 +450,7 @@ class _createTaskState extends State<createTask> {
),
(Route<dynamic> route) => false);
},
child: const Text('Annoler'),
child: const Text('Annuler'),
),
],
),
Expand Down
54 changes: 34 additions & 20 deletions lib/Screens/forgot_password.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
),
);
return true;
}
else {
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Erreur lors de la réinitialisation du mot de passe: ${response.statusCode}'),
content: Text(
'Erreur lors de la réinitialisation du mot de passe: ${response.statusCode}'),
backgroundColor: Colors.red,
),
);
Expand All @@ -61,7 +61,8 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Une erreur s\'est produite. Veuillez réessayer plus tard.'),
content:
Text('Une erreur s\'est produite. Veuillez réessayer plus tard.'),
backgroundColor: Colors.red,
),
);
Expand Down Expand Up @@ -113,30 +114,21 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
icon: Icons.person,
hintName: 'Email',
inputtype: TextInputType.text),
const SizedBox(height: 5.0),
const SizedBox(height: 10.0),
GetTextFormField(
controller: _conpassword,
icon: Icons.lock,
hintName: 'mot de passe',
isObscureText: true,
),
const SizedBox(height: 5.0),
const SizedBox(height: 10.0),
GetTextFormField(
controller: _conconfpassword,
icon: Icons.lock,
hintName: 'confirmer mot de passe',
isObscureText: true,
),
const SizedBox(height: 20.0),
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const LoginForm()),
);
},
child: const Text('Retourner à la page de connexion'),
),
const SizedBox(height: 15.0),
Container(
margin: const EdgeInsets.all(30.0),
width: double.infinity,
Expand All @@ -146,17 +138,39 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
child: TextButton(
onPressed: () async {
if (await resetPassword()) {
await Future.delayed(const Duration(seconds: 1)); // Attendez 1 seconde
onResetPasswordSuccess(context); // Redirigez vers LoginForm uniquement si la réinitialisation du mot de passe a réussi
await Future.delayed(
const Duration(seconds: 1)); // Attendez 1 seconde
onResetPasswordSuccess(
context); // Redirigez vers LoginForm uniquement si la réinitialisation du mot de passe a réussi
}
},
child: const Text(
'Reinitialiser le mot de passe',
style: TextStyle(
color: Color.fromARGB(255, 197, 198, 243)),
style:
TextStyle(color: Color.fromARGB(255, 197, 198, 243),
fontSize: 18.0,
),
),
),
),
const SizedBox(height: 80.0),
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const LoginForm()),
);
},
child: const Text(
'Retour à la page de connexion',
style: TextStyle(
fontSize: 20.0,
color: Colors.white70,
),
),
),

],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/Screens/inscrire.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class _InscrireFormState extends State<InscrireForm> {
width: 100.0,
),
const Text(
"s'inscrire",
"Inscrivez-vous",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
Expand Down
Loading

0 comments on commit 64df43a

Please sign in to comment.