46 lines
1.1 KiB
Dart
46 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../theme.dart';
|
|
|
|
class TimerDisplay extends StatelessWidget {
|
|
final int seconds;
|
|
final String? label;
|
|
final TextStyle? style;
|
|
|
|
const TimerDisplay({
|
|
super.key,
|
|
required this.seconds,
|
|
this.label,
|
|
this.style,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final minutes = seconds ~/ 60;
|
|
final secs = seconds % 60;
|
|
final timeText = minutes > 0
|
|
? '$minutes:${secs.toString().padLeft(2, '0')}'
|
|
: '$secs';
|
|
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (label != null)
|
|
Text(
|
|
label!,
|
|
style: Theme.of(context).textTheme.labelLarge?.copyWith(
|
|
color: MirrorTheme.accent,
|
|
letterSpacing: 8,
|
|
),
|
|
),
|
|
if (label != null) const SizedBox(height: 40),
|
|
Text(
|
|
timeText,
|
|
style: style ?? Theme.of(context).textTheme.displayLarge?.copyWith(
|
|
color: MirrorTheme.accent,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|