wip(watch-ui): sauvegarde travail en cours lot UI (#176 #177)

This commit is contained in:
2026-07-29 12:41:30 +02:00
parent f523a5a8b5
commit 193827aacd
2 changed files with 82 additions and 43 deletions

View File

@ -2849,6 +2849,17 @@ final class _CurrentStepPane extends StatelessWidget {
), ),
], ],
const SizedBox(height: 4), 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( Row(
children: [ children: [
Expanded( 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,23 +2924,38 @@ final class _TimedStepBody extends StatelessWidget {
children: [ children: [
Text('Objectif : ${_formatShortSeconds(step.defaultTargetValue)}'), Text('Objectif : ${_formatShortSeconds(step.defaultTargetValue)}'),
const SizedBox(height: 4), const SizedBox(height: 4),
Center( Expanded(
child: Text( 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, remainingLabel,
style: Theme.of(context).textTheme.displayMedium?.copyWith( textAlign: TextAlign.center,
style: Theme.of(context).textTheme.displayMedium
?.copyWith(
fontFamily: 'Anton', fontFamily: 'Anton',
fontFeatures: AppTextStyles.timer(context).fontFeatures, fontFeatures: AppTextStyles.timer(
context,
).fontFeatures,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
), ),
),
if (!running) ...[ if (!running) ...[
const SizedBox(height: 8), const SizedBox(height: 8),
if (readyToStart) ...[ if (readyToStart) ...[
Text( Text(
'Chrono prêt', 'Chrono prêt',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleSmall?.copyWith( style: Theme.of(context).textTheme.titleSmall
?.copyWith(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
), ),
@ -2958,6 +2971,13 @@ final class _TimedStepBody extends StatelessWidget {
), ),
], ],
], ],
),
),
);
},
),
),
],
); );
} }
} }

View File

@ -1947,7 +1947,20 @@ void main() {
find.widgetWithText(OutlinedButton, 'Passer létape'), find.widgetWithText(OutlinedButton, 'Passer létape'),
findsOneWidget, 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.tap(find.text('Étape suivante'));
await tester.pump(); await tester.pump();
@ -1997,6 +2010,12 @@ void main() {
await tester.pump(); await tester.pump();
expect(find.text('00:05'), findsOneWidget); 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.tap(find.widgetWithText(FilledButton, 'Lancer'));
await tester.pump(); await tester.pump();
clock.value = DateTime.utc(2026, 7, 17, 12, 0, 2); clock.value = DateTime.utc(2026, 7, 17, 12, 0, 2);