fix: Fehlerbehandlung beim Laden und Meldungen überarbeiten
Reklamationen der Fahrer: Meldungen verdeckten Buttons, und nach dem Abschluss stand „Lieferung nicht in der Tour gefunden" ohne Ausweg da. Meldungen: - Erfolgs-SnackBars entfernt, bei Erfolg bleibt der Spinner - einheitliche, schwebende Meldungen statt Stau über den Buttons - Server-Rohtexte durch verständliche Texte ersetzt (api_failure_text) Laden: - fehlt eine geöffnete Lieferung, wird die Tour einmal neu geholt; die Meldung kommt nur nach erfolgreichem Abruf ohne die Lieferung - Endlos-Spinner auf Lieferdetail, Filial-Abholung und Beladen ersetzt durch Kopfzeile, Fehlergrund und „Erneut versuchen" - Tour wird nach einem Tageswechsel nachgeladen, offene Seiten bleiben dabei unberührt - Abschluss und Zuweisung überschreiben kein zwischenzeitliches Neuladen, alte Antworten drehen einen Abschluss nicht mehr zurück - leere Server-Antworten gelten als Fehler statt als „keine Daten" Anmeldung: - Token-Erneuerung wartet höchstens 12 s, der native Aufruf läuft weiter - App-Start ohne Netz zeigt einen Hinweis mit „Erneut versuchen" - Fehlerseite der Fahrzeugauswahl bietet „Abmelden" Außerdem Podfile.lock an die Plugins angeglichen. Tests für die neuen Fehlerpfade ergänzt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -29,6 +29,58 @@ class StepNotes extends StatelessWidget {
|
||||
final Delivery delivery;
|
||||
final TourDetails details;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final notes = details.notesOf(delivery.id);
|
||||
// Notizen & Fotos sind nur bei aktiver Lieferung änderbar. Ist die
|
||||
// Lieferung beendet (abgeschlossen/abgebrochen/pausiert), bleiben sie
|
||||
// sichtbar, aber read-only: kein FAB, keine Aktions-Menüs, kein Löschen.
|
||||
final active = delivery.state == DeliveryState.active;
|
||||
// Sauber in Text-Notizen und Fotos aufteilen — getrennte Sektionen.
|
||||
final textNotes =
|
||||
notes.where((n) => n.imageAttachment == null).toList(growable: false);
|
||||
final photoNotes =
|
||||
notes.where((n) => n.imageAttachment != null).toList(growable: false);
|
||||
return ListView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 100),
|
||||
children: [
|
||||
if (!active) ...[
|
||||
const _ReadOnlyBanner(),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
_SectionHeader(text: 'Notizen (${textNotes.length})'),
|
||||
const SizedBox(height: 8),
|
||||
if (textNotes.isEmpty)
|
||||
const _EmptyHint(
|
||||
icon: Icons.notes,
|
||||
text: 'Noch keine Notizen erfasst.',
|
||||
)
|
||||
else
|
||||
for (final n in textNotes)
|
||||
_NoteCard(note: n, deliveryId: delivery.id, active: active),
|
||||
const SizedBox(height: 24),
|
||||
_SectionHeader(text: 'Fotos (${photoNotes.length})'),
|
||||
const SizedBox(height: 8),
|
||||
if (photoNotes.isEmpty)
|
||||
const _EmptyHint(
|
||||
icon: Icons.photo_camera_outlined,
|
||||
text: 'Noch keine Fotos aufgenommen.',
|
||||
)
|
||||
else
|
||||
for (final n in photoNotes)
|
||||
_PhotoCard(note: n, deliveryId: delivery.id, active: active),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// „Hinzufügen"-Button des Notizen-Steps. Sitzt im `floatingActionButton`-Slot
|
||||
/// der Detail-Page, damit SnackBars ihn nicht verdecken.
|
||||
class StepNotesAddButton extends StatelessWidget {
|
||||
const StepNotesAddButton({super.key, required this.delivery});
|
||||
|
||||
final Delivery delivery;
|
||||
|
||||
void _openAddNoteDialog(BuildContext context) {
|
||||
final tourBloc = context.read<TourBloc>();
|
||||
showDialog<void>(
|
||||
@ -81,61 +133,9 @@ class StepNotes extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final notes = details.notesOf(delivery.id);
|
||||
// Notizen & Fotos sind nur bei aktiver Lieferung änderbar. Ist die
|
||||
// Lieferung beendet (abgeschlossen/abgebrochen/pausiert), bleiben sie
|
||||
// sichtbar, aber read-only: kein FAB, keine Aktions-Menüs, kein Löschen.
|
||||
final active = delivery.state == DeliveryState.active;
|
||||
// Sauber in Text-Notizen und Fotos aufteilen — getrennte Sektionen.
|
||||
final textNotes =
|
||||
notes.where((n) => n.imageAttachment == null).toList(growable: false);
|
||||
final photoNotes =
|
||||
notes.where((n) => n.imageAttachment != null).toList(growable: false);
|
||||
return Stack(
|
||||
children: [
|
||||
ListView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 100),
|
||||
children: [
|
||||
if (!active) ...[
|
||||
const _ReadOnlyBanner(),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
_SectionHeader(text: 'Notizen (${textNotes.length})'),
|
||||
const SizedBox(height: 8),
|
||||
if (textNotes.isEmpty)
|
||||
const _EmptyHint(
|
||||
icon: Icons.notes,
|
||||
text: 'Noch keine Notizen erfasst.',
|
||||
)
|
||||
else
|
||||
for (final n in textNotes)
|
||||
_NoteCard(note: n, deliveryId: delivery.id, active: active),
|
||||
const SizedBox(height: 24),
|
||||
_SectionHeader(text: 'Fotos (${photoNotes.length})'),
|
||||
const SizedBox(height: 8),
|
||||
if (photoNotes.isEmpty)
|
||||
const _EmptyHint(
|
||||
icon: Icons.photo_camera_outlined,
|
||||
text: 'Noch keine Fotos aufgenommen.',
|
||||
)
|
||||
else
|
||||
for (final n in photoNotes)
|
||||
_PhotoCard(note: n, deliveryId: delivery.id, active: active),
|
||||
],
|
||||
),
|
||||
// FAB nur bei aktiver Lieferung — sonst ist Hinzufügen gesperrt.
|
||||
if (active)
|
||||
Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: _AddMenu(
|
||||
onAddNote: () => _openAddNoteDialog(context),
|
||||
onAddImage: () => _pickImage(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
return _AddMenu(
|
||||
onAddNote: () => _openAddNoteDialog(context),
|
||||
onAddImage: () => _pickImage(context),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user