mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-07-04 15:23:02 +02:00
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>
64 lines
1.7 KiB
Dart
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),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|