feat: product search screen with catalog add and success feedback
- Add product search screen (/products/search) as primary add flow; "Add" button on products list opens search, manual entry remains as fallback - Add to shelf bottom sheet with AnimatedSwitcher success view (green checkmark) and SnackBar confirmation on the search screen via onAdded callback - Manual add (AddProductScreen) shows SnackBar on success before popping back - Extend AddProductScreen with optional nutrition fields (calories, protein, fat, carbs, fiber); auto-fills from catalog selection and auto-expands section - Auto-upsert catalog product on backend when nutrition data is provided without a primary_product_id, linking the user product to the catalog - Add fiber_per_100g field to CatalogProduct model and CreateRequest - Add 16 new L10n keys across all 12 locales (addProduct, addManually, searchProducts, quantity, storageDays, addToShelf, nutritionOptional, calories, protein, fat, carbs, fiber, productAddedToShelf, etc.) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,8 @@ class CatalogProduct {
|
||||
final double? fatPer100g;
|
||||
@JsonKey(name: 'carbs_per_100g')
|
||||
final double? carbsPer100g;
|
||||
@JsonKey(name: 'fiber_per_100g')
|
||||
final double? fiberPer100g;
|
||||
|
||||
const CatalogProduct({
|
||||
required this.id,
|
||||
@@ -37,6 +39,7 @@ class CatalogProduct {
|
||||
this.proteinPer100g,
|
||||
this.fatPer100g,
|
||||
this.carbsPer100g,
|
||||
this.fiberPer100g,
|
||||
});
|
||||
|
||||
/// Display name is the server-resolved canonical name (language-aware from backend).
|
||||
|
||||
@@ -19,6 +19,7 @@ CatalogProduct _$CatalogProductFromJson(Map<String, dynamic> json) =>
|
||||
proteinPer100g: (json['protein_per_100g'] as num?)?.toDouble(),
|
||||
fatPer100g: (json['fat_per_100g'] as num?)?.toDouble(),
|
||||
carbsPer100g: (json['carbs_per_100g'] as num?)?.toDouble(),
|
||||
fiberPer100g: (json['fiber_per_100g'] as num?)?.toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CatalogProductToJson(CatalogProduct instance) =>
|
||||
@@ -34,4 +35,5 @@ Map<String, dynamic> _$CatalogProductToJson(CatalogProduct instance) =>
|
||||
'protein_per_100g': instance.proteinPer100g,
|
||||
'fat_per_100g': instance.fatPer100g,
|
||||
'carbs_per_100g': instance.carbsPer100g,
|
||||
'fiber_per_100g': instance.fiberPer100g,
|
||||
};
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// This file is intentionally empty.
|
||||
// saved_recipe.dart now uses a manually written fromJson/toJson.
|
||||
Reference in New Issue
Block a user