Files
Client/lib/view/pages/ticker/widgets/ticker_updated_bar.dart
T

43 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import '../../../../extensions/date_time.dart';
import '../../../../theming/app_theme.dart';
/// Non-interactive "Aktualisiert am …" mini heading above the content card
/// (refresh is pull-to-refresh). Left-aligned with the card's content indent.
/// Renders nothing when [publishedAt] is missing/unparseable.
class TickerUpdatedBar extends StatelessWidget {
final String? publishedAt;
const TickerUpdatedBar({super.key, this.publishedAt});
@override
Widget build(BuildContext context) {
final iso = publishedAt;
final parsed = iso == null || iso.isEmpty ? null : DateTime.tryParse(iso);
if (parsed == null) return const SizedBox.shrink();
final theme = Theme.of(context);
final muted = theme.colorScheme.onSurfaceVariant;
return Padding(
padding: const EdgeInsets.fromLTRB(
AppSpacing.sm + AppSpacing.md,
AppSpacing.sm,
AppSpacing.md,
AppSpacing.xs,
),
child: Row(
children: [
Icon(Icons.schedule, size: 13, color: muted),
const SizedBox(width: AppSpacing.xs),
Text(
'Aktualisiert am ${parsed.toLocal().formatDateTime()}',
style: theme.textTheme.labelSmall?.copyWith(color: muted),
),
],
),
);
}
}