import 'package:flutter/material.dart'; import 'live_info_business_object.dart'; import 'time_formatter.dart'; class TrackCard extends StatelessWidget { const TrackCard({ super.key, required this.label, required this.track, required this.titleColor, required this.cardSurface, required this.cardBorder, }); final String label; final LiveInfoTrackInfo? track; final Color titleColor; final Color cardSurface; final Color cardBorder; @override Widget build(BuildContext context) { final String title = track?.displayTitle ?? 'Unavailable'; final String subtitle = (track?.displaySubtitle ?? '').trim(); final String window = formatTimeWindow(track?.starts, track?.ends); return Container( padding: const EdgeInsets.all(12), decoration: BoxDecoration( color: cardSurface, borderRadius: BorderRadius.circular(14), border: Border.all(color: cardBorder), ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Text( label, style: Theme.of(context).textTheme.labelMedium?.copyWith( fontWeight: FontWeight.w700, color: titleColor, ), ), const SizedBox(height: 6), Text( title, maxLines: 2, overflow: TextOverflow.ellipsis, style: Theme.of( context, ).textTheme.titleMedium?.copyWith( fontWeight: FontWeight.w700, color: titleColor, ), ), const SizedBox(height: 6), Text( subtitle.isEmpty ? 'No metadata provided' : subtitle, maxLines: 6, overflow: TextOverflow.ellipsis, style: Theme.of( context, ).textTheme.bodySmall?.copyWith(color: titleColor), ), const Spacer(), Text( window, style: Theme.of( context, ).textTheme.labelMedium?.copyWith( fontWeight: FontWeight.w600, color: titleColor, ), ), ], ), ); } }