feat: Gestion des secteurs et migration v3.0.4+304
- Ajout système complet de gestion des secteurs avec contours géographiques - Import des contours départementaux depuis GeoJSON - API REST pour la gestion des secteurs (/api/sectors) - Service de géolocalisation pour déterminer les secteurs - Migration base de données avec tables x_departements_contours et sectors_adresses - Interface Flutter pour visualisation et gestion des secteurs - Ajout thème sombre dans l'application - Corrections diverses et optimisations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
19
app/lib/presentation/widgets/sector_distribution_card.dart
Normal file → Executable file
19
app/lib/presentation/widgets/sector_distribution_card.dart
Normal file → Executable file
@@ -11,11 +11,11 @@ class SectorDistributionCard extends StatelessWidget {
|
||||
final EdgeInsetsGeometry? padding;
|
||||
|
||||
const SectorDistributionCard({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.title = 'Répartition par secteur',
|
||||
this.height,
|
||||
this.padding,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -49,10 +49,12 @@ class SectorDistributionCard extends StatelessWidget {
|
||||
Widget _buildAutoRefreshContent() {
|
||||
// Écouter les changements des deux boîtes
|
||||
return ValueListenableBuilder(
|
||||
valueListenable: Hive.box<SectorModel>(AppKeys.sectorsBoxName).listenable(),
|
||||
valueListenable:
|
||||
Hive.box<SectorModel>(AppKeys.sectorsBoxName).listenable(),
|
||||
builder: (context, Box<SectorModel> sectorsBox, child) {
|
||||
return ValueListenableBuilder(
|
||||
valueListenable: Hive.box<PassageModel>(AppKeys.passagesBoxName).listenable(),
|
||||
valueListenable:
|
||||
Hive.box<PassageModel>(AppKeys.passagesBoxName).listenable(),
|
||||
builder: (context, Box<PassageModel> passagesBox, child) {
|
||||
return _buildContent(sectorsBox, passagesBox);
|
||||
},
|
||||
@@ -61,7 +63,8 @@ class SectorDistributionCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContent(Box<SectorModel> sectorsBox, Box<PassageModel> passagesBox) {
|
||||
Widget _buildContent(
|
||||
Box<SectorModel> sectorsBox, Box<PassageModel> passagesBox) {
|
||||
try {
|
||||
// Calculer les statistiques
|
||||
final sectorStats = _calculateSectorStats(sectorsBox, passagesBox);
|
||||
@@ -104,8 +107,8 @@ class SectorDistributionCard extends StatelessWidget {
|
||||
final Map<int, int> sectorCounts = {};
|
||||
|
||||
for (final passage in passages) {
|
||||
// Exclure les passages où fkType==2
|
||||
if (passage.fkSector != null && passage.fkType != 2) {
|
||||
// Exclure les passages où fkType==2 et ceux sans secteur
|
||||
if (passage.fkType != 2 && passage.fkSector != null) {
|
||||
sectorCounts[passage.fkSector!] =
|
||||
(sectorCounts[passage.fkSector!] ?? 0) + 1;
|
||||
}
|
||||
@@ -179,4 +182,4 @@ class SectorDistributionCard extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user