54 lines
1.7 KiB
Dart
54 lines
1.7 KiB
Dart
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 Card(
|
|
child: entryComment != null
|
|
? ExpansionTile(
|
|
iconColor: color,
|
|
collapsedShape: shape,
|
|
shape: shape,
|
|
leading: icon,
|
|
title: title,
|
|
collapsedBackgroundColor: color,
|
|
backgroundColor:
|
|
Theme.of(context).colorScheme.secondary.withOpacity(0.8),
|
|
children: entryComment != null
|
|
? [
|
|
Text(
|
|
entryComment ?? '',
|
|
style: const TextStyle(
|
|
color: Colors.white, fontWeight: FontWeight.bold),
|
|
)
|
|
]
|
|
: [],
|
|
)
|
|
: ListTile(
|
|
shape: shape,
|
|
leading: icon,
|
|
title: title,
|
|
tileColor: color,
|
|
));
|
|
}
|
|
}
|