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
import 'package:flutter/material.dart';
import 'package:nfc_google_sheet/components/folder.dart';
import 'package:nfc_google_sheet/context/colories.dart';
import 'package:nfc_google_sheet/pages/sheet_page.dart';
class MatierePage extends StatefulWidget {
final Map<String, dynamic> filiere;
const MatierePage({Key? key, required this.filiere}) : super(key: key);
@override
_MatierePageState createState() => _MatierePageState();
}
class _MatierePageState extends State<MatierePage> {
int? _selectedMatiereIndex;
IconData _getIconData(String iconName) {
switch (iconName) {
case 'psychology': return Icons.psychology;
case 'smartphone': return Icons.smartphone;
case 'code': return Icons.code;
case 'computer': return Icons.computer;
case 'sensors': return Icons.sensors;
case 'memory': return Icons.memory;
case 'bar_chart': return Icons.bar_chart;
case 'smart_toy': return Icons.smart_toy;
case 'lan': return Icons.lan;
case 'hub': return Icons.hub;
case 'share': return Icons.share;
case 'functions': return Icons.functions;
case 'security': return Icons.security;
case 'storage': return Icons.storage;
case 'calculate': return Icons.calculate;
case 'code_off': return Icons.code_off;
case 'build': return Icons.build;
case 'chat': return Icons.chat;
case 'mouse': return Icons.mouse;
case 'translate': return Icons.translate;
case 'mediation': return Icons.mediation;
case 'science': return Icons.science;
case 'web': return Icons.web;
case 'dns': return Icons.dns;
case 'wifi': return Icons.wifi;
case 'settings_system_daydream': return Icons.settings_system_daydream;
case 'integration_instructions': return Icons.integration_instructions;
case 'web_asset': return Icons.web_asset;
case 'rule': return Icons.rule;
case 'engineering': return Icons.engineering;
case 'architecture': return Icons.architecture;
case 'assignment': return Icons.assignment;
case 'work': return Icons.work;
case 'lightbulb': return Icons.lightbulb;
case 'directions_run': return Icons.directions_run;
case 'analytics': return Icons.analytics;
case 'camera': return Icons.camera;
case 'square_foot': return Icons.square_foot;
case 'description': return Icons.description;
default: return Icons.subject;
}
}
@override
Widget build(BuildContext context) {
final List<dynamic> matieres = widget.filiere['matieres'];
return Scaffold(
backgroundColor: Colories.background,
appBar: AppBar(
title: Text(widget.filiere['nom'], style: TextStyle(color: Colories.selected)),
backgroundColor: Colories.background,
elevation: 0,
centerTitle: true,
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 16,
mainAxisSpacing: 16,
childAspectRatio: 1,
),
itemCount: matieres.length,
itemBuilder: (context, index) {
final matiere = matieres[index];
return Folder(
nom: matiere['nom'],
icon: _getIconData(matiere['icon']),
isSelected: _selectedMatiereIndex == index,
onTap: () {
setState(() {
_selectedMatiereIndex = index;
});
SheetPage.selectedMatiere = matiere['nom'];
},
);
},
),
),
],
),
),
);
}
}