Add household sharing feature

 Features:
- Create household with 6-character shareable code
- Join existing household with code
- View household members and owner
- Leave household functionality
- Automatic inventory filtering by household
- Persistent household settings across app updates

🔧 Technical changes:
- Added Household model with Hive adapter (typeId: 4)
- Updated AppSettings with userName and currentHouseholdId fields
- Modified InventoryRepository to filter items by household
- Updated Add Item screen to set householdId on new items
- Added HouseholdScreen with full CRUD operations
- Integrated household sharing into Settings navigation

🎯 Behavior:
- Users not in a household see only their personal items
- Users in a household see shared household items
- New items automatically tagged with current household

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 14:46:10 -04:00
parent f4be460c3e
commit a360fadc17
9 changed files with 707 additions and 12 deletions

View File

@@ -0,0 +1,53 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'household.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class HouseholdAdapter extends TypeAdapter<Household> {
@override
final int typeId = 4;
@override
Household read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return Household(
id: fields[0] as String,
name: fields[1] as String,
ownerName: fields[2] as String,
createdAt: fields[3] as DateTime?,
members: (fields[4] as List?)?.cast<String>(),
);
}
@override
void write(BinaryWriter writer, Household obj) {
writer
..writeByte(5)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.name)
..writeByte(2)
..write(obj.ownerName)
..writeByte(3)
..write(obj.createdAt)
..writeByte(4)
..write(obj.members);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is HouseholdAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}