import 'package:flutter/material.dart'; import 'package:smoke_cess_app/widgets/entry_detail_title.dart'; class EntryDetail extends StatelessWidget { final DateTime date; final String entryData; final String? entryComment; final IconData iconData; const EntryDetail( {super.key, required this.date, required this.entryData, required this.iconData, required this.entryComment}); @override Widget build(BuildContext context) { final Icon icon = Icon(iconData, color: Colors.white); final ShapeBorder shape = RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ); final Color color = Theme.of(context).colorScheme.primary.withOpacity(0.8); final Widget title = EntryDetailTitle(date: date, entryData: entryData); return entryComment != null ? ExpansionTile( iconColor: Colors.white, collapsedIconColor: Colors.white, collapsedShape: shape, shape: shape, leading: icon, title: title, collapsedBackgroundColor: color, backgroundColor: Theme.of(context).colorScheme.secondary.withOpacity(0.8), children: entryComment != null ? [ Row(mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.fromLTRB(10, 0, 10, 10), child: Text( entryComment ?? '', style: const TextStyle( color: Colors.white, fontWeight: FontWeight.bold), )) ]) ] : [], ) : ListTile( shape: shape, leading: icon, title: title, tileColor: color, ); } }