- Flutter/Dart (iOS + Android), Riverpod, go_router, i18n via ARB (deutsch) - Feature-Struktur: today, plants, locations, household (V2-Platzhalter), settings - Intervall-Modell: Aufgaben werden aus lastWatered/lastFertilized + Intervall berechnet - In-Memory-Demo-Daten, Firebase-Anbindung folgt im nächsten Block - Doku: Architektur, Firebase-Einrichtung, Forgejo-Git-Hosting Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
71 lines
2.1 KiB
Dart
71 lines
2.1 KiB
Dart
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.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 – werden später von Claude erzeugt.
|
||
final String description;
|
||
final String careNotes;
|
||
|
||
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,
|
||
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,
|
||
wateringIntervalDays: wateringIntervalDays ?? this.wateringIntervalDays,
|
||
fertilizingIntervalDays:
|
||
fertilizingIntervalDays ?? this.fertilizingIntervalDays,
|
||
lastWatered: lastWatered ?? this.lastWatered,
|
||
lastFertilized: lastFertilized ?? this.lastFertilized,
|
||
);
|
||
}
|
||
}
|