Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import 'package:flutter/material.dart';
import 'package:nfc_google_sheet/context/colories.dart';
import 'package:nfc_google_sheet/pages/filiere_page.dart';
import '../database/databaseHelper.dart';
class ExamPage extends StatelessWidget {
const ExamPage({super.key});
@override
Widget build(BuildContext context) {
return MyExamPage();
}
}
class MyExamPage extends StatefulWidget{
const MyExamPage({super.key});
@override
State<MyExamPage> createState() => _MyExamPageState();
}
class _MyExamPageState extends State<MyExamPage>{
void _deleteAllUsers() async {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
backgroundColor: Colories.background,
title: Text("Confirmer la suppression", style: TextStyle(color: Colories.selected)),
content: Text("Êtes-vous sûr de vouloir supprimer toutes les données des étudiants ?", style: TextStyle(color: Colories.unselected)),
actions: [
TextButton(
child: Text("Annuler", style: TextStyle(color: Colories.unselected)),
onPressed: () => Navigator.of(context).pop(),
),
ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: Colors.red.shade400),
child: Text("Supprimer", style: TextStyle(color: Colories.background)),
onPressed: () async {
await DatabaseHelper.instance.clear();
Navigator.of(context).pop();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Toutes les données ont été supprimées.'),
backgroundColor: Colors.red,
),
);
},
),
],
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colories.background,
appBar: AppBar(
title: Text('Options', style: TextStyle(color: Colories.selected)),
backgroundColor: Colories.background,
elevation: 0,
centerTitle: true,
),
body: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Gestion des données et examens',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colories.title,
),
),
SizedBox(height: 40),
SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => FilierePage()),
);
},
icon: Icon(Icons.school, color: Colories.background),
label: Text(
"VOIR LES FILIÈRES",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colories.selected,
foregroundColor: Colories.background,
padding: EdgeInsets.symmetric(vertical: 18),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
),
),
SizedBox(height: 20),
SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: _deleteAllUsers,
icon: Icon(Icons.delete_forever, color: Colories.background),
label: Text(
"SUPPRIMER LES DONNÉES",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red.shade400,
foregroundColor: Colories.background,
padding: EdgeInsets.symmetric(vertical: 18),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
),
),
],
),
),
);
}
}