55 lines
1.6 KiB
Dart
55 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class SummaryHeader extends StatelessWidget {
|
|
const SummaryHeader({
|
|
super.key,
|
|
required this.totalDuration,
|
|
required this.entryCount,
|
|
});
|
|
|
|
final Duration totalDuration;
|
|
final int entryCount;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final h = totalDuration.inHours;
|
|
final m = totalDuration.inMinutes % 60;
|
|
final label = h > 0 ? '${h}h ${m}m' : '${m}m';
|
|
|
|
return Card(
|
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Row(
|
|
children: [
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Total', style: Theme.of(context).textTheme.labelMedium),
|
|
Text(
|
|
label,
|
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const Spacer(),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Text('Entries', style: Theme.of(context).textTheme.labelMedium),
|
|
Text(
|
|
'$entryCount',
|
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|