leafittome/lib/features/plants/domain/plant.dart
cschlaefke 41e31bed88 Foto-Flow mit KI-Erkennung: Kamera, Cloud Function identifyPlant, Storage für Fotos
- Cloud Function (europe-west3): PlantNet-Erkennung mit Claude-Fallback, deutsches Pflegeprofil von Claude, Keys als Secrets
- Pflanzen-Formular: Foto aufnehmen/wählen, Felder werden automatisch vorbefüllt
- Fotos in Storage unter households/{id}/plant-photos, Anzeige in Liste und Profil
- storage.rules mit Haushalts-Prinzip, iOS-Berechtigungstexte für Kamera/Fotos
- Doku Schritt 5: Storage aktivieren, PlantNet-Key, Secrets setzen

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 00:05:46 +02:00

77 lines
2.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/foundation.dart';
/// Eine Pflanze im Haushalt.
///
/// Das Modell ist bewusst haushaltszentriert gedacht: Sobald das
/// Firebase-Backend angebunden ist, leben Pflanzen unter
/// `households/{householdId}/plants/{plantId}`.
@immutable
class Plant {
const Plant({
required this.id,
required this.nickname,
required this.species,
required this.wateringIntervalDays,
required this.fertilizingIntervalDays,
this.locationId,
this.description = '',
this.careNotes = '',
this.photoUrl,
this.lastWatered,
this.lastFertilized,
});
final String id;
/// Vom Nutzer vergebener Name, z. B. "Omas Monstera".
final String nickname;
/// Pflanzenart (deutsch und/oder botanisch). Wird später von der
/// PlantNet-Erkennung befüllt, kann aber auch frei eingegeben werden.
final String species;
/// Referenz auf einen Stellplatz des Haushalts (optional).
final String? locationId;
/// Beschreibung und Pflegehinweise von der KI erzeugt oder leer.
final String description;
final String careNotes;
/// Download-URL des Pflanzenfotos in Firebase Storage (optional).
final String? photoUrl;
final int wateringIntervalDays;
final int fertilizingIntervalDays;
/// `null` bedeutet: noch nie erledigt → Aufgabe ist sofort fällig.
final DateTime? lastWatered;
final DateTime? lastFertilized;
Plant copyWith({
String? nickname,
String? species,
String? Function()? locationId,
String? description,
String? careNotes,
String? photoUrl,
int? wateringIntervalDays,
int? fertilizingIntervalDays,
DateTime? lastWatered,
DateTime? lastFertilized,
}) {
return Plant(
id: id,
nickname: nickname ?? this.nickname,
species: species ?? this.species,
locationId: locationId != null ? locationId() : this.locationId,
description: description ?? this.description,
careNotes: careNotes ?? this.careNotes,
photoUrl: photoUrl ?? this.photoUrl,
wateringIntervalDays: wateringIntervalDays ?? this.wateringIntervalDays,
fertilizingIntervalDays:
fertilizingIntervalDays ?? this.fertilizingIntervalDays,
lastWatered: lastWatered ?? this.lastWatered,
lastFertilized: lastFertilized ?? this.lastFertilized,
);
}
}