Improve the LatestReport Page
This commit is contained in:
@@ -88,6 +88,8 @@ class _LatestReportColumnState extends State<LatestReportColumn>{
|
|||||||
widgets.add(LatestReportEntry(
|
widgets.add(LatestReportEntry(
|
||||||
text: reports[i].title,
|
text: reports[i].title,
|
||||||
icon: icon,
|
icon: icon,
|
||||||
|
author: reports[i].author,
|
||||||
|
timestamp: reports[i].timestamp,
|
||||||
onTap: () => _openReport(report),
|
onTap: () => _openReport(report),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,19 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class LatestReportEntry extends StatelessWidget{
|
class LatestReportEntry extends StatelessWidget{
|
||||||
const LatestReportEntry({super.key, required this.text, required this.icon, this.onTap});
|
const LatestReportEntry({
|
||||||
|
super.key,
|
||||||
|
required this.text,
|
||||||
|
required this.icon,
|
||||||
|
required this.author,
|
||||||
|
required this.timestamp,
|
||||||
|
this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
final String text;
|
final String text;
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
|
final String author;
|
||||||
|
final DateTime timestamp;
|
||||||
final VoidCallback? onTap;
|
final VoidCallback? onTap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -23,8 +32,28 @@ class LatestReportEntry extends StatelessWidget{
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(icon),
|
Icon(icon),
|
||||||
Text(text),
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
spacing: 4,
|
||||||
|
children: [
|
||||||
|
// Long titles are wrapped over multiple lines instead of overflowing.
|
||||||
|
Text(
|
||||||
|
text,
|
||||||
|
softWrap: true,
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"$author • ${_timestampLabel()}",
|
||||||
|
softWrap: true,
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
),
|
),
|
||||||
margin: EdgeInsetsGeometry.all(16),
|
margin: EdgeInsetsGeometry.all(16),
|
||||||
@@ -32,4 +61,16 @@ class LatestReportEntry extends StatelessWidget{
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// e.g. "15.08.2025 09:05"
|
||||||
|
String _timestampLabel() {
|
||||||
|
final DateTime local = timestamp.toLocal();
|
||||||
|
|
||||||
|
final String day = local.day.toString().padLeft(2, '0');
|
||||||
|
final String month = local.month.toString().padLeft(2, '0');
|
||||||
|
final String hour = local.hour.toString().padLeft(2, '0');
|
||||||
|
final String minute = local.minute.toString().padLeft(2, '0');
|
||||||
|
|
||||||
|
return "$day.$month.${local.year} $hour:$minute";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user