screen-locker/stronglift_replacement/workout_app/lib/widgets/break_banner.dart
Krzysztof kuhy Rudnicki 735f900bf8 fix: restore per-rep breaks with audio/vibration
Breaks belong after each rep (circle tap), not removed entirely.
Restored break_banner, audioplayers, vibration, and break_end.mp3 asset.
Break triggers on every circle tap except the last one; 3 min on success,
5 min on failure; sound + vibration fires when the countdown ends.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:32:37 +02:00

64 lines
1.7 KiB
Dart

/// Countdown banner displayed at the top of the workout screen during a rest.
library;
import 'package:flutter/material.dart';
class BreakBanner extends StatelessWidget {
const BreakBanner({
super.key,
required this.breakRemaining,
required this.breakLabel,
required this.onSkip,
});
final int breakRemaining;
final String breakLabel;
final VoidCallback onSkip;
String _fmt(int secs) {
final m = (secs ~/ 60).toString().padLeft(2, '0');
final s = (secs % 60).toString().padLeft(2, '0');
return '$m:$s';
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.indigo.shade900,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
breakLabel,
style: const TextStyle(color: Colors.white70, fontSize: 12),
),
Text(
_fmt(breakRemaining),
style: const TextStyle(
color: Colors.white,
fontSize: 26,
fontWeight: FontWeight.bold,
fontFeatures: [FontFeature.tabularFigures()],
),
),
],
),
),
TextButton(
onPressed: onSkip,
child: const Text(
'Skip',
style: TextStyle(color: Colors.white70),
),
),
],
),
);
}
}