2026-02-21 20:40:33 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
2026-04-12 20:45:24 +02:00
|
|
|
import 'package:pomodoro_app/models/pomodoro_state.dart';
|
|
|
|
|
import 'package:pomodoro_app/theme/pomodoro_theme.dart';
|
2026-02-21 20:40:33 +01:00
|
|
|
|
|
|
|
|
/// Shows completed pomodoro indicators as filled/unfilled dots.
|
|
|
|
|
class PomodoroIndicators extends StatelessWidget {
|
|
|
|
|
/// Creates [PomodoroIndicators].
|
|
|
|
|
const PomodoroIndicators({
|
|
|
|
|
required this.state,
|
|
|
|
|
super.key,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/// The current Pomodoro state.
|
|
|
|
|
final PomodoroState state;
|
|
|
|
|
|
|
|
|
|
@override
|
2026-04-12 20:45:24 +02:00
|
|
|
Widget build(BuildContext context) => Row(
|
2026-02-21 20:40:33 +01:00
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: List.generate(
|
|
|
|
|
state.pomodorosPerCycle,
|
|
|
|
|
(index) {
|
|
|
|
|
final isCompleted = index < state.completedPomodoros % state.pomodorosPerCycle;
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 6),
|
|
|
|
|
child: AnimatedContainer(
|
|
|
|
|
duration: const Duration(milliseconds: 300),
|
|
|
|
|
width: 14,
|
|
|
|
|
height: 14,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
color: isCompleted
|
|
|
|
|
? PomodoroTheme.workColor
|
|
|
|
|
: Colors.white24,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: PomodoroTheme.workColor.withValues(alpha: 0.5),
|
|
|
|
|
width: 2,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|