feat(ui): compteur de série visible pendant l'exécution (ticket #34)
Affiche le compteur de série en cours sur workout_execution_screen.dart. flutter analyze propre, 58/58 tests verts, build APK debug validé. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -124,6 +124,11 @@ final class _WorkoutExecutionScreenState extends State<WorkoutExecutionScreen> {
|
||||
progressLabel: _plan.progressLabel(_position),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_SeriesCounterCard(
|
||||
currentSet: _position.setIndex + 1,
|
||||
totalSets: _exercise.setsCount,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(_exercise.name, style: Theme.of(context).textTheme.headlineMedium),
|
||||
const SizedBox(height: 16),
|
||||
SetMeasureInput(
|
||||
@ -168,10 +173,15 @@ final class _WorkoutExecutionScreenState extends State<WorkoutExecutionScreen> {
|
||||
),
|
||||
if (next != null && nextExercise != null) ...[
|
||||
const SizedBox(height: 24),
|
||||
Text('Ensuite : ${nextExercise.name}', textAlign: TextAlign.center),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Ensuite : ${nextExercise.name} · '
|
||||
'Série ${next.setIndex + 1}/${nextExercise.setsCount}',
|
||||
'Série ${next.setIndex + 1} / ${nextExercise.setsCount}',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.displaySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
fontSize: 30,
|
||||
),
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
@ -1304,10 +1314,8 @@ final class WorkoutExecutionPlan {
|
||||
|
||||
String progressLabel(ExecutionPosition position) {
|
||||
final program = programAt(position);
|
||||
final exercise = exerciseAt(position);
|
||||
return 'Programme ${position.programIndex + 1}/${programs.length} · '
|
||||
'Exercice ${position.exerciseIndex + 1}/${program.exercises.length} · '
|
||||
'Série ${position.setIndex + 1}/${exercise.setsCount}';
|
||||
'Exercice ${position.exerciseIndex + 1}/${program.exercises.length}';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1463,6 +1471,42 @@ final class _Header extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
final class _SeriesCounterCard extends StatelessWidget {
|
||||
const _SeriesCounterCard({required this.currentSet, required this.totalSets});
|
||||
|
||||
final int currentSet;
|
||||
final int totalSets;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final tokens = courtBlazerTokensOf(context);
|
||||
return CourtBlazerAccentPanel(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'SÉRIE',
|
||||
style: theme.textTheme.labelSmall?.copyWith(
|
||||
color: tokens.mutedText,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
'$currentSet / $totalSets',
|
||||
style: theme.textTheme.displayLarge?.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
fontSize: 48,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _formatDuration(Duration duration) {
|
||||
final minutes = duration.inMinutes.remainder(60).toString().padLeft(2, '0');
|
||||
final seconds = duration.inSeconds.remainder(60).toString().padLeft(2, '0');
|
||||
|
||||
@ -165,6 +165,7 @@ void main() {
|
||||
|
||||
expect(find.text('Repos avant la prochaine série'), findsOneWidget);
|
||||
expect(find.text('00:45'), findsOneWidget);
|
||||
expect(find.text('Série 2 / 2'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text('+15 s'));
|
||||
await tester.pump();
|
||||
@ -181,6 +182,9 @@ void main() {
|
||||
testWidgets('la mesure temps enregistre une durée réelle de série', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.binding.setSurfaceSize(const Size(400, 1400));
|
||||
addTearDown(() => tester.binding.setSurfaceSize(null));
|
||||
|
||||
final clock = _FakeClock(DateTime.utc(2026, 7, 17, 12));
|
||||
final repository = _FakeActiveSessionRepository();
|
||||
final session = ActiveWorkoutSession(
|
||||
@ -221,6 +225,9 @@ void main() {
|
||||
testWidgets(
|
||||
'terminer la série 2 avec temps répétitions et score manuel avance',
|
||||
(tester) async {
|
||||
await tester.binding.setSurfaceSize(const Size(400, 1400));
|
||||
addTearDown(() => tester.binding.setSurfaceSize(null));
|
||||
|
||||
final clock = _FakeClock(DateTime.utc(2026, 7, 17, 12));
|
||||
final repository = _FakeActiveSessionRepository();
|
||||
final session = ActiveWorkoutSession(
|
||||
@ -256,10 +263,9 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
find.text('Programme 1/1 · Exercice 1/1 · Série 2/3'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Programme 1/1 · Exercice 1/1'), findsOneWidget);
|
||||
expect(find.text('SÉRIE'), findsOneWidget);
|
||||
expect(find.text('2 / 3'), findsOneWidget);
|
||||
expect(find.text('30 s'), findsOneWidget);
|
||||
|
||||
for (var i = 0; i < 3; i++) {
|
||||
@ -279,10 +285,8 @@ void main() {
|
||||
expect(repository.results.single.actualReps, 3);
|
||||
expect(repository.results.single.actualScore, 5);
|
||||
expect(repository.session?.currentSetIndex, 2);
|
||||
expect(
|
||||
find.text('Programme 1/1 · Exercice 1/1 · Série 3/3'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Programme 1/1 · Exercice 1/1'), findsOneWidget);
|
||||
expect(find.text('3 / 3'), findsOneWidget);
|
||||
},
|
||||
);
|
||||
|
||||
@ -445,10 +449,8 @@ void main() {
|
||||
await tester.tap(find.byTooltip('Fermer'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.text('Programme 1/1 · Exercice 1/1 · Série 3/4'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Programme 1/1 · Exercice 1/1'), findsOneWidget);
|
||||
expect(find.text('3 / 4'), findsOneWidget);
|
||||
},
|
||||
);
|
||||
|
||||
@ -493,10 +495,8 @@ void main() {
|
||||
|
||||
expect(find.text('Plan de séance'), findsNothing);
|
||||
expect(find.text('Modifier la série'), findsNothing);
|
||||
expect(
|
||||
find.text('Programme 1/1 · Exercice 1/1 · Série 2/3'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Programme 1/1 · Exercice 1/1'), findsOneWidget);
|
||||
expect(find.text('2 / 3'), findsOneWidget);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user