diff --git a/lib/presentation/workout_execution_screen.dart b/lib/presentation/workout_execution_screen.dart index 4577ba5..2c5ba57 100644 --- a/lib/presentation/workout_execution_screen.dart +++ b/lib/presentation/workout_execution_screen.dart @@ -2849,6 +2849,17 @@ final class _CurrentStepPane extends StatelessWidget { ), ], const SizedBox(height: 4), + if (step.type == ExerciseStepType.reps) ...[ + FilledButton.icon( + onPressed: onCompleteStep, + style: FilledButton.styleFrom( + minimumSize: const Size.fromHeight(48), + ), + icon: const Icon(Icons.check), + label: const Text('Étape suivante'), + ), + const SizedBox(height: 8), + ], Row( children: [ Expanded( @@ -2882,19 +2893,6 @@ final class _CurrentStepPane extends StatelessWidget { ), ], ), - if (step.type == ExerciseStepType.reps) ...[ - const SizedBox(width: 8), - Expanded( - child: FilledButton.icon( - onPressed: onCompleteStep, - style: FilledButton.styleFrom( - minimumSize: const Size.fromHeight(44), - ), - icon: const Icon(Icons.check), - label: const Text('Étape suivante'), - ), - ), - ], ], ), ], @@ -2926,37 +2924,59 @@ final class _TimedStepBody extends StatelessWidget { children: [ Text('Objectif : ${_formatShortSeconds(step.defaultTargetValue)}'), const SizedBox(height: 4), - Center( - child: Text( - remainingLabel, - style: Theme.of(context).textTheme.displayMedium?.copyWith( - fontFamily: 'Anton', - fontFeatures: AppTextStyles.timer(context).fontFeatures, - color: Theme.of(context).colorScheme.primary, - ), + Expanded( + child: LayoutBuilder( + builder: (context, constraints) { + return FittedBox( + fit: BoxFit.contain, + alignment: Alignment.center, + child: SizedBox( + width: constraints.maxWidth, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + remainingLabel, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.displayMedium + ?.copyWith( + fontFamily: 'Anton', + fontFeatures: AppTextStyles.timer( + context, + ).fontFeatures, + color: Theme.of(context).colorScheme.primary, + ), + ), + if (!running) ...[ + const SizedBox(height: 8), + if (readyToStart) ...[ + Text( + 'Chrono prêt', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.titleSmall + ?.copyWith( + color: Theme.of(context).colorScheme.primary, + ), + ), + const SizedBox(height: 4), + ], + FilledButton.icon( + onPressed: onStartTimer, + style: FilledButton.styleFrom( + minimumSize: const Size.fromHeight(48), + ), + icon: const Icon(Icons.play_arrow), + label: const Text('Lancer'), + ), + ], + ], + ), + ), + ); + }, ), ), - if (!running) ...[ - const SizedBox(height: 8), - if (readyToStart) ...[ - Text( - 'Chrono prêt', - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.titleSmall?.copyWith( - color: Theme.of(context).colorScheme.primary, - ), - ), - const SizedBox(height: 4), - ], - FilledButton.icon( - onPressed: onStartTimer, - style: FilledButton.styleFrom( - minimumSize: const Size.fromHeight(48), - ), - icon: const Icon(Icons.play_arrow), - label: const Text('Lancer'), - ), - ], ], ); } diff --git a/test/presentation/workout_execution_screen_test.dart b/test/presentation/workout_execution_screen_test.dart index 5c71526..99db0f4 100644 --- a/test/presentation/workout_execution_screen_test.dart +++ b/test/presentation/workout_execution_screen_test.dart @@ -1947,7 +1947,20 @@ void main() { find.widgetWithText(OutlinedButton, 'Passer l’étape'), findsOneWidget, ); - expect(find.widgetWithText(FilledButton, 'Étape suivante'), findsOneWidget); + final nextStepButton = find.widgetWithText(FilledButton, 'Étape suivante'); + final skipStepButton = find.widgetWithText( + OutlinedButton, + 'Passer l’étape', + ); + expect(nextStepButton, findsOneWidget); + expect( + tester.getTopLeft(nextStepButton).dy, + lessThan(tester.getTopLeft(skipStepButton).dy), + ); + expect( + tester.getSize(nextStepButton).width, + greaterThan(tester.getSize(skipStepButton).width), + ); await tester.tap(find.text('Étape suivante')); await tester.pump(); @@ -1997,6 +2010,12 @@ void main() { await tester.pump(); expect(find.text('00:05'), findsOneWidget); + expect( + find.byWidgetPredicate( + (widget) => widget is FittedBox && widget.fit == BoxFit.contain, + ), + findsWidgets, + ); await tester.tap(find.widgetWithText(FilledButton, 'Lancer')); await tester.pump(); clock.value = DateTime.utc(2026, 7, 17, 12, 0, 2);