/// Bottom sheet de détails d'un impact : modification du score et suppression. /// /// Partagée entre l'écran d'analyse (consultation du plotting) et l'éditeur /// d'impacts plein écran, qui opèrent sur le même AnalysisProvider. library; import 'package:flutter/material.dart'; import '../../../data/models/shot.dart'; import '../analysis_provider.dart'; void showShotDetailsSheet( BuildContext context, AnalysisProvider provider, Shot shot, ) { showModalBottomSheet( context: context, builder: (context) => Container( padding: const EdgeInsets.all(24), child: Column( mainAxisSize: MainAxisSize.min, children: [ Text( 'Impact #${provider.shots.indexOf(shot) + 1}', style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18), ), Text( 'ID: ${shot.id}', style: Theme.of(context) .textTheme .bodySmall ?.copyWith(color: Colors.grey, fontSize: 10), ), const SizedBox(height: 16), ListTile( leading: const Icon(Icons.score), title: const Text('Modifier le score'), trailing: DropdownButton( value: shot.score.clamp(0, 10), items: List.generate(11, (index) => index) .map( (s) => DropdownMenuItem( value: s, child: Text( '$s', style: const TextStyle( fontWeight: FontWeight.bold, fontSize: 18, ), ), ), ) .toList(), onChanged: (newScore) { if (newScore != null) { provider.updateShotScore(shot.id, newScore); Navigator.pop(context); } }, ), ), const SizedBox(height: 24), Row( children: [ Expanded( child: OutlinedButton.icon( onPressed: () { provider.removeShot(shot.id); Navigator.pop(context); }, icon: const Icon(Icons.delete, color: Colors.red), label: const Text( 'SUPPRIMER', style: TextStyle(color: Colors.red), ), ), ), ], ), ], ), ), ); }