Preserve Flutter mirror-os codebase
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user