fix(execution): comportement de la flèche retour en séance (ticket #31)
Corrige la flèche de retour sur workout_execution_screen.dart : elle ouvre désormais le choix pause/abandon ou quitter-et-sauvegarder au lieu de ne rien faire. flutter analyze propre, 36/36 tests verts, build APK debug validé. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -78,8 +78,17 @@ final class _WorkoutExecutionScreenState extends State<WorkoutExecutionScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: _handleSystemBack,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
leading: _canPauseFromNavigation
|
||||
? IconButton(
|
||||
tooltip: 'Mettre en pause',
|
||||
onPressed: () => unawaited(_pause()),
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
)
|
||||
: null,
|
||||
title: Text(_plan.name),
|
||||
actions: [
|
||||
IconButton(
|
||||
@ -263,6 +272,16 @@ final class _WorkoutExecutionScreenState extends State<WorkoutExecutionScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
bool get _canPauseFromNavigation {
|
||||
return _mode == WorkoutExecutionMode.active ||
|
||||
_mode == WorkoutExecutionMode.rest;
|
||||
}
|
||||
|
||||
void _handleSystemBack(bool didPop) {
|
||||
if (didPop || !_canPauseFromNavigation) return;
|
||||
unawaited(_pause());
|
||||
}
|
||||
|
||||
Future<void> _pause() async {
|
||||
_restTicker?.cancel();
|
||||
_session = await widget.activeUseCases.pause(_session.metadata.id);
|
||||
|
||||
Reference in New Issue
Block a user