testsAndMisc-archive/pomodoro_app/lib/widgets/timer_controls.dart
Krzysztof kuhy Rudnicki 01091c09ce Add tests and fix pre-commit issues across all projects
- C/lichess_random_engine, vocabulary_curve, misc/split,
  1dvelocitysimulator, opening_learner: test suites added
- CPP/miscelanious: tests added
- TS/battery-status, champions_leauge_scores, two-inputs: tests added
- python_pkg/fm24_searcher, wake_alarm: new packages added
- Fix ruff/cppcheck/eslint/clang-format failures
- Update .gitignore for C/C++ build artifacts
2026-04-12 20:45:24 +02:00

80 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:pomodoro_app/models/pomodoro_state.dart';
import 'package:pomodoro_app/theme/pomodoro_theme.dart';
/// Row of control buttons for the Pomodoro timer.
class TimerControls extends StatelessWidget {
/// Creates [TimerControls].
const TimerControls({
required this.state,
required this.onStart,
required this.onPause,
required this.onReset,
required this.onSkip,
super.key,
});
/// The current Pomodoro state.
final PomodoroState state;
/// Callback when user taps start.
final VoidCallback onStart;
/// Callback when user taps pause.
final VoidCallback onPause;
/// Callback when user taps reset.
final VoidCallback onReset;
/// Callback when user taps skip.
final VoidCallback onSkip;
@override
Widget build(BuildContext context) {
final color = PomodoroTheme.colorForMode(state.mode);
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Reset button.
IconButton(
onPressed: onReset,
icon: const Icon(Icons.refresh),
iconSize: 32,
tooltip: 'Reset',
color: Colors.white70,
),
const SizedBox(width: 16),
// Play / Pause button.
SizedBox(
width: 72,
height: 72,
child: ElevatedButton(
onPressed: state.isRunning ? onPause : onStart,
style: ElevatedButton.styleFrom(
backgroundColor: color,
foregroundColor: Colors.white,
shape: const CircleBorder(),
padding: EdgeInsets.zero,
),
child: Icon(
state.isRunning ? Icons.pause : Icons.play_arrow,
size: 36,
),
),
),
const SizedBox(width: 16),
// Skip button.
IconButton(
onPressed: onSkip,
icon: const Icon(Icons.skip_next),
iconSize: 32,
tooltip: 'Skip',
color: Colors.white70,
),
],
);
}
}