Messwerte Scroller

This commit is contained in:
2025-10-25 00:15:13 +02:00
parent 74414e7728
commit 4cb18aba41
@@ -914,12 +914,6 @@ class _IgelDetailState extends ConsumerState<IgelDetailScreen> {
],
icon: const Icon(Icons.ios_share),
),
if (canEdit)
IconButton(
onPressed: _pickAndUpload,
tooltip: 'Bilder hinzufügen',
icon: const Icon(Icons.add_a_photo),
),
],
),
body: Stack(
@@ -1170,39 +1164,45 @@ class _IgelDetailState extends ConsumerState<IgelDetailScreen> {
child: Text('Keine Messwerte'),
)
else
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columns: [
const DataColumn(
label: Text('Datum/Uhrzeit')),
const DataColumn(
label: Text('Gewicht (g)')),
const DataColumn(
label: Text('Behandlung')),
const DataColumn(
label: Text('Bemerkung')),
if (canEdit)
const DataColumn(
label: Text('Aktionen')),
],
rows: [
for (final m in messwerte)
DataRow(
cells: [
DataCell(Text(
_fmtDateTime(m.datum))),
DataCell(
Text('${m.gewicht}')),
DataCell(Text(
m.behandlung ?? '')),
DataCell(Text(
m.bemerkung ?? '')),
if (canEdit)
DataCell(
Row(
mainAxisSize:
MainAxisSize.min,
SizedBox(
// fixe Höhe für angenehmes Scrollen; gerne anpassen (z. B. 360480)
height: 420,
child: Scrollbar(
thumbVisibility: true,
child: ListView.separated(
itemCount: messwerte.length,
separatorBuilder: (_, __) =>
const Divider(height: 1),
itemBuilder: (_, i) {
final m = messwerte[i];
return ListTile(
dense: true,
leading: const Icon(
Icons.timeline),
title: Text(
_fmtDateTime(m.datum)),
subtitle: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Text(
'Gewicht: ${m.gewicht} g'),
if ((m.behandlung ?? '')
.trim()
.isNotEmpty)
Text(
'Behandlung: ${m.behandlung}'),
if ((m.bemerkung ?? '')
.trim()
.isNotEmpty)
Text(
'Bemerkung: ${m.bemerkung}'),
],
),
trailing: canEdit
? Wrap(
spacing: 4,
children: [
IconButton(
tooltip:
@@ -1223,11 +1223,17 @@ class _IgelDetailState extends ConsumerState<IgelDetailScreen> {
m),
),
],
),
),
],
),
],
)
: null,
isThreeLine: true,
contentPadding:
const EdgeInsets
.symmetric(
horizontal: 12,
vertical: 6),
);
},
),
),
),
],