Import sorgenti Flutter di Henflow (export da Nextcloud: lib/ + documenti di progetto)

This commit is contained in:
Carlo Baratto
2026-10-09 08:51:15 +02:00
commit bfd086c488
14 changed files with 4129 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import 'breed_catalog.dart';
import 'hen.dart';
class BreedSetting {
final String breedId;
List<Hen> hens;
BreedSetting({
required this.breedId,
required this.hens,
});
Map<String, dynamic> toMap() {
return {
'breedId': breedId,
'hens': hens.map((e) => e.toMap()).toList(),
};
}
factory BreedSetting.fromMap(Map<String, dynamic> map) {
return BreedSetting(
breedId: map['breedId'],
hens: ((map['hens'] ?? []) as List)
.map((e) => Hen.fromMap(Map<String, dynamic>.from(e)))
.toList(),
);
}
int get activeHensCount {
return hens.where((hen) => hen.isLaying).length;
}
double get dailyProduction =>
activeHensCount * breedFromId(breedId).eggsPerHenPerDay;
}