feat: implement AI export service and establish project navigation and theming infrastructure + acces internet
Build & Release Android APK / build-apk (push) Successful in 23m34s

This commit is contained in:
streaper2
2026-08-27 18:32:59 +02:00
parent e943538133
commit 8dc6542603
19 changed files with 3312 additions and 1055 deletions
+80 -32
View File
@@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
import 'package:fl_chart/fl_chart.dart'; // La librairie pour les courbes
import 'package:path/path.dart' as p;
import 'package:share_plus/share_plus.dart';
import '../../core/theme/app_theme.dart';
import '../../core/widgets/metric_info_button.dart';
import '../../data/models/session.dart';
import '../../data/repositories/session_repository.dart';
@@ -235,6 +236,7 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
extendBody: true,
appBar: AppBar(
title: const Text('Statistiques'),
centerTitle: true,
@@ -296,7 +298,7 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
onRefresh: _loadStatistics,
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.fromLTRB(16, 16, 16, 100),
child: Column(
children: [
// 2. DONNÉES RAPIDES (Tirs et Sessions)
@@ -414,13 +416,14 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
);
}
final activeColor = const Color(0xFF1A73E8);
final isDark = Theme.of(context).brightness == Brightness.dark;
final activeColor = Theme.of(context).colorScheme.primary;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
decoration: BoxDecoration(
color: activeColor.withValues(alpha: 0.08),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: activeColor.withValues(alpha: 0.3)),
color: activeColor.withValues(alpha: isDark ? 0.12 : 0.08),
borderRadius: BorderRadius.circular(14),
border: Border.all(color: activeColor.withValues(alpha: 0.35)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -429,7 +432,15 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
children: [
Icon(Icons.compare_arrows, color: activeColor, size: 18),
const SizedBox(width: 6),
Text('Comparaison', style: TextStyle(fontWeight: FontWeight.bold, color: activeColor)),
Text(
'Comparaison de sessions',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 13,
color: activeColor,
letterSpacing: 0.3,
),
),
const Spacer(),
IconButton(
tooltip: 'Quitter la comparaison',
@@ -493,27 +504,39 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
List<String> items,
void Function(String?) onChanged,
) {
final theme = Theme.of(context);
final isDark = Theme.of(context).brightness == Brightness.dark;
final textSecondary = isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: theme.dividerColor),
color: isDark ? AppTheme.darkSurfaceElevated : AppTheme.lightSurfaceVariant,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: isDark ? AppTheme.darkBorder : AppTheme.lightBorder,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(color: theme.textTheme.bodySmall?.color?.withValues(alpha: 0.6), fontSize: 10),
style: TextStyle(
color: textSecondary,
fontSize: 10,
fontWeight: FontWeight.w600,
),
),
DropdownButton<String>(
value: value,
isExpanded: true,
underline: Container(),
dropdownColor: theme.colorScheme.surfaceContainerHighest,
style: TextStyle(color: theme.textTheme.bodyMedium?.color, fontSize: 14),
underline: const SizedBox(),
dropdownColor: isDark ? AppTheme.darkSurfaceElevated : AppTheme.lightSurfaceVariant,
style: TextStyle(
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
fontSize: 13,
fontWeight: FontWeight.w600,
),
items: items
.map(
(String val) =>
@@ -529,28 +552,45 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
// Widget pour les petites cartes de stats
Widget _buildQuickStat(String label, String value, IconData icon) {
final theme = Theme.of(context);
final isDark = Theme.of(context).brightness == Brightness.dark;
final primary = Theme.of(context).colorScheme.primary;
return Container(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(12),
color: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: isDark ? AppTheme.darkBorder : AppTheme.lightBorder,
),
),
child: Column(
children: [
Icon(icon, color: const Color(0xFF1A73E8), size: 20),
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: primary.withValues(alpha: isDark ? 0.15 : 0.1),
borderRadius: BorderRadius.circular(10),
),
child: Icon(icon, color: primary, size: 20),
),
const SizedBox(height: 8),
Text(
value,
style: TextStyle(
color: theme.textTheme.titleLarge?.color,
fontSize: 20,
fontWeight: FontWeight.bold,
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
fontSize: 22,
fontWeight: FontWeight.w800,
letterSpacing: -0.5,
),
),
const SizedBox(height: 2),
Text(
label,
style: TextStyle(color: theme.textTheme.bodySmall?.color?.withValues(alpha: 0.6), fontSize: 12),
style: TextStyle(
color: isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary,
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
],
),
@@ -564,12 +604,15 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
List<double> dataPoints, {
List<MetricExplanation>? explanations,
}) {
final theme = Theme.of(context);
final isDark = Theme.of(context).brightness == Brightness.dark;
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceContainerHighest.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(12),
color: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: isDark ? AppTheme.darkBorder : AppTheme.lightBorder,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -578,7 +621,11 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
children: [
Text(
title,
style: TextStyle(color: theme.textTheme.bodyMedium?.color?.withValues(alpha: 0.7), fontSize: 14),
style: TextStyle(
color: isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary,
fontSize: 13,
fontWeight: FontWeight.w600,
),
),
if (explanations != null) ...[
const Spacer(),
@@ -586,15 +633,16 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
],
],
),
const SizedBox(height: 10),
const SizedBox(height: 8),
Row(
children: [
Text(
value,
style: TextStyle(
color: theme.textTheme.headlineMedium?.color,
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
fontSize: 24,
fontWeight: FontWeight.bold,
fontWeight: FontWeight.w800,
letterSpacing: -0.5,
),
),
const SizedBox(width: 20),