v1.3.0+4: FOSS Compliance + Dark Mode + Enhanced Settings

 Major Features:
- Dark mode toggle with app-wide theme switching
- Sort inventory by Expiration Date, Name, or Location
- Toggle between Grid and List view for inventory
- Export inventory data to CSV with share functionality
- Custom sage leaf app icon with adaptive icon support

🔄 FOSS Compliance (F-Droid Ready):
- Replaced Firebase with Supabase (open-source backend)
- Anonymous authentication (no user accounts required)
- Cloud-first with hosted Supabase as default
- Optional self-hosting support
- 100% FOSS-compliant dependencies

🎨 UI/UX Improvements:
- Dynamic version display from package.json (was hardcoded)
- Added edit buttons for household and user names
- Removed non-functional search button
- Replaced Recipes placeholder with Settings button
- Improved settings organization with clear sections

📦 Dependencies:
Added:
- supabase_flutter: ^2.8.4 (FOSS backend sync)
- package_info_plus: ^8.1.0 (dynamic version)
- csv: ^6.0.0 (data export)
- share_plus: ^10.1.2 (file sharing)
- image: ^4.5.4 (dev, icon generation)

Removed:
- firebase_core (replaced with Supabase)
- cloud_firestore (replaced with Supabase)

🗑️ Cleanup:
- Removed Firebase setup files and google-services.json
- Removed unimplemented features (Recipes, Search)
- Removed firebase_household_service.dart
- Removed inventory_sync_service.dart (replaced with Supabase)

📄 New Files:
- lib/features/household/services/supabase_household_service.dart
- web/privacy-policy.html (Play Store requirement)
- web/terms-of-service.html (Play Store requirement)
- PLAY_STORE_LISTING.md (marketing copy)
- tool/generate_icons.dart (icon generation script)
- assets/icon/sage_leaf.png (1024x1024)
- assets/icon/sage_leaf_foreground.png (adaptive icon)

🐛 Bug Fixes:
- Fixed version display showing hardcoded "1.0.0"
- Fixed Sort By and Default View showing static text
- Fixed ConsumerWidget build signatures
- Fixed Location.displayName import issues
- Added clearAllData method to Hive database

📊 Stats: +1,728 additions, -756 deletions across 42 files

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 22:27:42 -04:00
parent af63e11abd
commit 7ab641a3c8
42 changed files with 1728 additions and 756 deletions

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../../core/constants/colors.dart';
import '../../../data/local/hive_database.dart';
import '../../household/services/firebase_household_service.dart';
import '../../household/services/supabase_household_service.dart';
import '../models/app_settings.dart';
import '../models/household.dart';
@@ -14,7 +14,7 @@ class HouseholdScreen extends StatefulWidget {
}
class _HouseholdScreenState extends State<HouseholdScreen> {
final _firebaseService = FirebaseHouseholdService();
final _supabaseService = SupabaseHouseholdService();
AppSettings? _settings;
Household? _household;
bool _isLoading = true;
@@ -31,8 +31,8 @@ class _HouseholdScreenState extends State<HouseholdScreen> {
if (settings.currentHouseholdId != null) {
try {
// Load from Firebase
household = await _firebaseService.getHousehold(settings.currentHouseholdId!);
// Load from Supabase
household = await _supabaseService.getHousehold(settings.currentHouseholdId!);
} catch (e) {
// Household not found
}
@@ -86,7 +86,7 @@ class _HouseholdScreenState extends State<HouseholdScreen> {
if (result != null && result.isNotEmpty) {
try {
// Create household in Firebase
final household = await _firebaseService.createHousehold(result, _settings!.userName!);
final household = await _supabaseService.createHousehold(result, _settings!.userName!);
// Also save to local Hive for offline access
await HiveDatabase.saveHousehold(household);
@@ -164,40 +164,24 @@ class _HouseholdScreenState extends State<HouseholdScreen> {
try {
final code = result.toUpperCase();
// Join household in Firebase
final success = await _firebaseService.joinHousehold(code, _settings!.userName!);
// Join household in Supabase
final household = await _supabaseService.joinHousehold(code, _settings!.userName!);
if (success) {
// Load the household data
final household = await _firebaseService.getHousehold(code);
// Save to local Hive for offline access
await HiveDatabase.saveHousehold(household);
if (household != null) {
// Save to local Hive for offline access
await HiveDatabase.saveHousehold(household);
_settings!.currentHouseholdId = household.id;
await _settings!.save();
_settings!.currentHouseholdId = household.id;
await _settings!.save();
await _loadData();
await _loadData();
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Joined ${household.name}!'),
backgroundColor: AppColors.success,
),
);
}
}
} else {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Household not found. Check the code and try again.'),
backgroundColor: AppColors.error,
),
);
}
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Joined ${household.name}!'),
backgroundColor: AppColors.success,
),
);
}
} catch (e) {
if (mounted) {
@@ -254,6 +238,66 @@ class _HouseholdScreenState extends State<HouseholdScreen> {
}
}
Future<void> _editHouseholdName() async {
final nameController = TextEditingController(text: _household!.name);
final result = await showDialog<String>(
context: context,
builder: (context) => AlertDialog(
title: const Text('Edit Household Name'),
content: TextField(
controller: nameController,
decoration: const InputDecoration(
labelText: 'Household Name',
hintText: 'e.g., Smith Family',
),
textCapitalization: TextCapitalization.words,
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Cancel'),
),
TextButton(
onPressed: () => Navigator.pop(context, nameController.text),
child: const Text('Save'),
),
],
),
);
if (result != null && result.isNotEmpty && result != _household!.name) {
try {
// Update in Supabase
await _supabaseService.updateHouseholdName(_household!.id, result);
// Update local
_household!.name = result;
await HiveDatabase.saveHousehold(_household!);
setState(() {});
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Household name updated!'),
backgroundColor: AppColors.success,
),
);
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Error updating name: $e'),
backgroundColor: AppColors.error,
),
);
}
}
}
}
Future<void> _leaveHousehold() async {
final confirm = await showDialog<bool>(
context: context,
@@ -280,7 +324,7 @@ class _HouseholdScreenState extends State<HouseholdScreen> {
if (confirm == true && _household != null) {
// Leave household in Firebase
await _firebaseService.leaveHousehold(_household!.id, _settings!.userName!);
await _supabaseService.leaveHousehold(_household!.id, _settings!.userName!);
_settings!.currentHouseholdId = null;
await _settings!.save();
@@ -392,18 +436,40 @@ class _HouseholdScreenState extends State<HouseholdScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_household!.name,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
Row(
children: [
Expanded(
child: Text(
_household!.name,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
IconButton(
icon: const Icon(Icons.edit, size: 20),
onPressed: _editHouseholdName,
tooltip: 'Edit household name',
),
],
),
Text(
'Owner: ${_household!.ownerName}',
style: TextStyle(
color: Colors.grey[600],
),
Row(
children: [
Expanded(
child: Text(
'You: ${_settings!.userName ?? "Not set"}',
style: TextStyle(
color: Colors.grey[600],
),
),
),
IconButton(
icon: const Icon(Icons.edit, size: 18),
onPressed: _showNameInputDialog,
tooltip: 'Edit your name',
),
],
),
],
),