feat: implement base architecture and core repositories for weapon tracking and target analysis functionality
This commit is contained in:
@@ -155,7 +155,7 @@ class HistoryChart extends StatelessWidget {
|
||||
return touchedSpots.map((spot) {
|
||||
final session = displaySessions[spot.x.toInt()];
|
||||
return LineTooltipItem(
|
||||
'Score: ${session.totalScore}\n${session.shotCount} tirs',
|
||||
'Score: ${session.totalScore}\n${session.totalShots} tirs',
|
||||
const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
/// Item de liste représentant une session.
|
||||
///
|
||||
/// Affiche les informations clés d'une session (date, type de cible,
|
||||
/// score, nombre de tirs) avec miniature de l'image et actions de suppression.
|
||||
library;
|
||||
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../data/models/session.dart';
|
||||
import '../../../data/models/target_type.dart';
|
||||
|
||||
class SessionListItem extends StatelessWidget {
|
||||
final Session session;
|
||||
@@ -33,7 +26,7 @@ class SessionListItem extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
children: [
|
||||
// Thumbnail
|
||||
// Thumbnail (from first target)
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: SizedBox(
|
||||
@@ -51,14 +44,14 @@ class SessionListItem extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
_getTargetIcon(),
|
||||
const Icon(
|
||||
Icons.shield,
|
||||
size: 16,
|
||||
color: AppTheme.primaryColor,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
session.targetType.displayName,
|
||||
session.weapon,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -70,18 +63,19 @@ class SessionListItem extends StatelessWidget {
|
||||
DateFormat('dd/MM/yyyy HH:mm').format(session.createdAt),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
if (session.notes != null && session.notes!.isNotEmpty) ...[
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
session.notes!,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Colors.grey[600],
|
||||
fontStyle: FontStyle.italic,
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.track_changes, size: 14, color: Colors.grey[600]),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${session.targetCount} cible(s) • ${session.distance}m',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -98,7 +92,7 @@ class SessionListItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${session.shotCount} tirs',
|
||||
'${session.totalShots} tirs',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
@@ -120,7 +114,9 @@ class SessionListItem extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildThumbnail() {
|
||||
final file = File(session.imagePath);
|
||||
if (session.analyses.isEmpty) return _buildPlaceholder();
|
||||
|
||||
final file = File(session.analyses.first.imagePath);
|
||||
|
||||
if (file.existsSync()) {
|
||||
return Image.file(
|
||||
@@ -137,18 +133,9 @@ class SessionListItem extends StatelessWidget {
|
||||
return Container(
|
||||
color: Colors.grey[200],
|
||||
child: Icon(
|
||||
_getTargetIcon(),
|
||||
Icons.track_changes,
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
IconData _getTargetIcon() {
|
||||
switch (session.targetType) {
|
||||
case TargetType.concentric:
|
||||
return Icons.track_changes;
|
||||
case TargetType.silhouette:
|
||||
return Icons.person;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user