feat: food search sheet with FTS+trgm, dish/recent endpoints, multilingual aliases
Backend: - GET /dishes/search — hybrid FTS (english + simple) + trgm + ILIKE search - GET /diary/recent — recently used dishes and products for the current user - product search upgraded: FTS on canonical_name and product_aliases, ranked by GREATEST(ts_rank, similarity) - importoff: collect product_name_ru/de/fr/... as product_aliases for multilingual search (e.g. "сникерс" → "Snickers") - migrations: FTS + trgm indexes merged into 001_initial_schema.sql (002 removed) Flutter: - FoodSearchSheet: debounced search field, recently-used section, product/dish results, scan-photo and barcode chips - DishPortionSheet: quick ½/1/1½/2 buttons + custom input - + button in meal card now opens FoodSearchSheet instead of going directly to AI scan - 7 new l10n keys across all 12 languages Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
27
client/lib/features/diary/food_search_provider.dart
Normal file
27
client/lib/features/diary/food_search_provider.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/auth/auth_provider.dart';
|
||||
import '../../shared/models/product.dart';
|
||||
import 'food_search_service.dart';
|
||||
|
||||
final foodSearchServiceProvider = Provider<FoodSearchService>(
|
||||
(ref) => FoodSearchService(ref.read(apiClientProvider)),
|
||||
);
|
||||
|
||||
/// Recently used diary items (dishes + products).
|
||||
final recentDiaryItemsProvider =
|
||||
FutureProvider.autoDispose<List<RecentDiaryItem>>((ref) {
|
||||
return ref.read(foodSearchServiceProvider).getRecent(limit: 15);
|
||||
});
|
||||
|
||||
/// Product search results for the given query string.
|
||||
final productSearchProvider = FutureProvider.autoDispose
|
||||
.family<List<CatalogProduct>, String>((ref, query) {
|
||||
return ref.read(foodSearchServiceProvider).searchProducts(query);
|
||||
});
|
||||
|
||||
/// Dish search results for the given query string.
|
||||
final dishSearchProvider = FutureProvider.autoDispose
|
||||
.family<List<DishSearchResult>, String>((ref, query) {
|
||||
return ref.read(foodSearchServiceProvider).searchDishes(query);
|
||||
});
|
||||
108
client/lib/features/diary/food_search_service.dart
Normal file
108
client/lib/features/diary/food_search_service.dart
Normal file
@@ -0,0 +1,108 @@
|
||||
import '../../core/api/api_client.dart';
|
||||
import '../../shared/models/product.dart';
|
||||
|
||||
/// Lightweight dish result returned by GET /dishes/search.
|
||||
class DishSearchResult {
|
||||
final String id;
|
||||
final String name;
|
||||
final String? imageUrl;
|
||||
final double avgRating;
|
||||
|
||||
const DishSearchResult({
|
||||
required this.id,
|
||||
required this.name,
|
||||
this.imageUrl,
|
||||
required this.avgRating,
|
||||
});
|
||||
|
||||
factory DishSearchResult.fromJson(Map<String, dynamic> json) {
|
||||
return DishSearchResult(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
imageUrl: json['image_url'] as String?,
|
||||
avgRating: (json['avg_rating'] as num?)?.toDouble() ?? 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// One item from GET /diary/recent.
|
||||
class RecentDiaryItem {
|
||||
final String itemType; // "dish" | "product"
|
||||
final String? dishId;
|
||||
final String? productId;
|
||||
final String name;
|
||||
final String? imageUrl;
|
||||
final String? categoryName;
|
||||
final double? caloriesPer100g;
|
||||
final double? caloriesPerServing;
|
||||
|
||||
const RecentDiaryItem({
|
||||
required this.itemType,
|
||||
this.dishId,
|
||||
this.productId,
|
||||
required this.name,
|
||||
this.imageUrl,
|
||||
this.categoryName,
|
||||
this.caloriesPer100g,
|
||||
this.caloriesPerServing,
|
||||
});
|
||||
|
||||
factory RecentDiaryItem.fromJson(Map<String, dynamic> json) {
|
||||
return RecentDiaryItem(
|
||||
itemType: json['item_type'] as String? ?? 'dish',
|
||||
dishId: json['dish_id'] as String?,
|
||||
productId: json['product_id'] as String?,
|
||||
name: json['name'] as String? ?? '',
|
||||
imageUrl: json['image_url'] as String?,
|
||||
categoryName: json['category_name'] as String?,
|
||||
caloriesPer100g: (json['calories_per_100g'] as num?)?.toDouble(),
|
||||
caloriesPerServing: (json['calories_per_serving'] as num?)?.toDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
/// For products: calories per 100 g; for dishes: calories per serving.
|
||||
double? get displayCalories =>
|
||||
itemType == 'product' ? caloriesPer100g : caloriesPerServing;
|
||||
}
|
||||
|
||||
/// Service for searching products/dishes and loading recently used diary items.
|
||||
class FoodSearchService {
|
||||
const FoodSearchService(this._client);
|
||||
|
||||
final ApiClient _client;
|
||||
|
||||
/// Searches catalog products by name.
|
||||
Future<List<CatalogProduct>> searchProducts(String query) async {
|
||||
if (query.isEmpty) return [];
|
||||
final list = await _client.getList(
|
||||
'/products/search',
|
||||
params: {'q': query, 'limit': '20'},
|
||||
);
|
||||
return list
|
||||
.map((item) => CatalogProduct.fromJson(item as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// Searches dishes by name.
|
||||
Future<List<DishSearchResult>> searchDishes(String query) async {
|
||||
if (query.isEmpty) return [];
|
||||
final list = await _client.getList(
|
||||
'/dishes/search',
|
||||
params: {'q': query, 'limit': '10'},
|
||||
);
|
||||
return list
|
||||
.map((item) => DishSearchResult.fromJson(item as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// Returns recent diary items (dishes and products) for the current user.
|
||||
Future<List<RecentDiaryItem>> getRecent({int limit = 10}) async {
|
||||
final list = await _client.getList(
|
||||
'/diary/recent',
|
||||
params: {'limit': '$limit'},
|
||||
);
|
||||
return list
|
||||
.map((item) => RecentDiaryItem.fromJson(item as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
689
client/lib/features/diary/food_search_sheet.dart
Normal file
689
client/lib/features/diary/food_search_sheet.dart
Normal file
@@ -0,0 +1,689 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/auth/auth_provider.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../../shared/models/product.dart';
|
||||
import 'barcode_scan_screen.dart';
|
||||
import 'food_search_provider.dart';
|
||||
import 'food_search_service.dart';
|
||||
import 'product_portion_sheet.dart';
|
||||
|
||||
/// Bottom sheet for searching and selecting food (product or dish) to add to diary.
|
||||
///
|
||||
/// When the search query is empty the sheet shows recently used items.
|
||||
/// When the search query is non-empty it shows product and dish search results.
|
||||
class FoodSearchSheet extends ConsumerStatefulWidget {
|
||||
const FoodSearchSheet({
|
||||
super.key,
|
||||
required this.mealType,
|
||||
required this.date,
|
||||
required this.onAdded,
|
||||
this.onScanDish,
|
||||
});
|
||||
|
||||
final String mealType;
|
||||
final String date;
|
||||
|
||||
/// Called after any diary entry has been successfully added.
|
||||
final VoidCallback onAdded;
|
||||
|
||||
/// Optional callback to trigger AI dish-from-photo recognition.
|
||||
/// When null the scan-photo chip is hidden.
|
||||
final VoidCallback? onScanDish;
|
||||
|
||||
@override
|
||||
ConsumerState<FoodSearchSheet> createState() => _FoodSearchSheetState();
|
||||
}
|
||||
|
||||
class _FoodSearchSheetState extends ConsumerState<FoodSearchSheet> {
|
||||
final TextEditingController _queryController = TextEditingController();
|
||||
Timer? _debounce;
|
||||
String _activeQuery = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_queryController.addListener(_onQueryChanged);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_debounce?.cancel();
|
||||
_queryController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onQueryChanged() {
|
||||
_debounce?.cancel();
|
||||
_debounce = Timer(const Duration(milliseconds: 300), () {
|
||||
final trimmed = _queryController.text.trim();
|
||||
if (trimmed != _activeQuery) {
|
||||
setState(() => _activeQuery = trimmed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _addProductToDiary(
|
||||
CatalogProduct catalogProduct, double portionGrams) async {
|
||||
await ref.read(apiClientProvider).post('/diary', data: {
|
||||
'product_id': catalogProduct.id,
|
||||
'portion_g': portionGrams,
|
||||
'meal_type': widget.mealType,
|
||||
'date': widget.date,
|
||||
'source': 'search',
|
||||
});
|
||||
}
|
||||
|
||||
void _openProductPortion(CatalogProduct catalogProduct) {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
builder: (sheetContext) => Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.viewInsetsOf(sheetContext).bottom,
|
||||
),
|
||||
child: ProductPortionSheet(
|
||||
catalogProduct: catalogProduct,
|
||||
onConfirm: (portionGrams) async {
|
||||
try {
|
||||
await _addProductToDiary(catalogProduct, portionGrams);
|
||||
widget.onAdded();
|
||||
if (mounted) Navigator.pop(context);
|
||||
} catch (_) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.addFailed),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _openDishPortion(DishSearchResult dish) {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
builder: (_) => _DishPortionSheet(
|
||||
dishId: dish.id,
|
||||
dishName: dish.name,
|
||||
mealType: widget.mealType,
|
||||
date: widget.date,
|
||||
onAdded: () {
|
||||
widget.onAdded();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _openRecentItem(RecentDiaryItem recentItem) {
|
||||
if (recentItem.itemType == 'product' && recentItem.productId != null) {
|
||||
final catalogProduct = CatalogProduct(
|
||||
id: recentItem.productId!,
|
||||
canonicalName: recentItem.name,
|
||||
categoryName: recentItem.categoryName,
|
||||
caloriesPer100g: recentItem.caloriesPer100g,
|
||||
);
|
||||
_openProductPortion(catalogProduct);
|
||||
} else if (recentItem.itemType == 'dish' && recentItem.dishId != null) {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
builder: (_) => _DishPortionSheet(
|
||||
dishId: recentItem.dishId!,
|
||||
dishName: recentItem.name,
|
||||
caloriesPerServing: recentItem.caloriesPerServing,
|
||||
mealType: widget.mealType,
|
||||
date: widget.date,
|
||||
onAdded: () {
|
||||
widget.onAdded();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _openBarcodeScanner() {
|
||||
Navigator.pop(context);
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => BarcodeScanScreen(
|
||||
mealType: widget.mealType,
|
||||
date: widget.date,
|
||||
onAdded: widget.onAdded,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return DraggableScrollableSheet(
|
||||
expand: false,
|
||||
initialChildSize: 0.92,
|
||||
minChildSize: 0.5,
|
||||
maxChildSize: 0.95,
|
||||
builder: (sheetContext, scrollController) {
|
||||
return Column(
|
||||
children: [
|
||||
// Drag handle
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.onSurfaceVariant
|
||||
.withValues(alpha: 0.4),
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Search field
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: TextField(
|
||||
controller: _queryController,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
hintText: l10n.searchFoodHint,
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
suffixIcon: _activeQuery.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear),
|
||||
onPressed: () {
|
||||
_queryController.clear();
|
||||
setState(() => _activeQuery = '');
|
||||
},
|
||||
)
|
||||
: null,
|
||||
border: const OutlineInputBorder(),
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Quick action chips
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
|
||||
child: Wrap(
|
||||
spacing: 8,
|
||||
children: [
|
||||
if (widget.onScanDish != null)
|
||||
ActionChip(
|
||||
avatar:
|
||||
const Icon(Icons.camera_alt_outlined, size: 18),
|
||||
label: Text(l10n.scanDishPhoto),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
widget.onScanDish!();
|
||||
},
|
||||
),
|
||||
ActionChip(
|
||||
avatar: const Icon(Icons.qr_code_scanner, size: 18),
|
||||
label: Text(l10n.scanBarcode),
|
||||
onPressed: _openBarcodeScanner,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Results area
|
||||
Expanded(
|
||||
child: _activeQuery.isEmpty
|
||||
? _RecentSection(
|
||||
scrollController: scrollController,
|
||||
onTap: _openRecentItem,
|
||||
)
|
||||
: _SearchResults(
|
||||
query: _activeQuery,
|
||||
scrollController: scrollController,
|
||||
onTapProduct: _openProductPortion,
|
||||
onTapDish: _openDishPortion,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Recently used section
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class _RecentSection extends ConsumerWidget {
|
||||
const _RecentSection({
|
||||
required this.scrollController,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final ScrollController scrollController;
|
||||
final void Function(RecentDiaryItem) onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final recentState = ref.watch(recentDiaryItemsProvider);
|
||||
|
||||
return recentState.when(
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (_, __) => const SizedBox.shrink(),
|
||||
data: (recentItems) {
|
||||
if (recentItems.isEmpty) return const SizedBox.shrink();
|
||||
return ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: recentItems.length + 1, // +1 for header
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
|
||||
child: Text(
|
||||
l10n.recentlyUsedLabel,
|
||||
style: Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final recentItem = recentItems[index - 1];
|
||||
return _FoodTile.fromRecent(
|
||||
recentItem: recentItem,
|
||||
onTap: () => onTap(recentItem),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Search results section
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class _SearchResults extends ConsumerWidget {
|
||||
const _SearchResults({
|
||||
required this.query,
|
||||
required this.scrollController,
|
||||
required this.onTapProduct,
|
||||
required this.onTapDish,
|
||||
});
|
||||
|
||||
final String query;
|
||||
final ScrollController scrollController;
|
||||
final void Function(CatalogProduct) onTapProduct;
|
||||
final void Function(DishSearchResult) onTapDish;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final theme = Theme.of(context);
|
||||
final productsState = ref.watch(productSearchProvider(query));
|
||||
final dishesState = ref.watch(dishSearchProvider(query));
|
||||
|
||||
if (productsState.isLoading && dishesState.isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
final products = productsState.valueOrNull ?? [];
|
||||
final dishes = dishesState.valueOrNull ?? [];
|
||||
|
||||
if (products.isEmpty && dishes.isEmpty) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Text(
|
||||
l10n.noResultsForQuery(query),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final items = <_ListItem>[];
|
||||
if (products.isNotEmpty) {
|
||||
items.add(_SectionHeader(l10n.productsSection));
|
||||
items.addAll(products.map(_ProductItem.new));
|
||||
}
|
||||
if (dishes.isNotEmpty) {
|
||||
items.add(_SectionHeader(l10n.dishesSection));
|
||||
items.addAll(dishes.map(_DishItem.new));
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final listItem = items[index];
|
||||
if (listItem is _SectionHeader) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
|
||||
child: Text(
|
||||
listItem.title,
|
||||
style: theme.textTheme.labelMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (listItem is _ProductItem) {
|
||||
return _FoodTile.fromProduct(
|
||||
catalogProduct: listItem.catalogProduct,
|
||||
onTap: () => onTapProduct(listItem.catalogProduct),
|
||||
);
|
||||
} else if (listItem is _DishItem) {
|
||||
return _FoodTile.fromDish(
|
||||
dish: listItem.dish,
|
||||
onTap: () => onTapDish(listItem.dish),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Flat-list item types ───────────────────────────────────────
|
||||
|
||||
sealed class _ListItem {}
|
||||
|
||||
final class _SectionHeader extends _ListItem {
|
||||
final String title;
|
||||
_SectionHeader(this.title);
|
||||
}
|
||||
|
||||
final class _ProductItem extends _ListItem {
|
||||
final CatalogProduct catalogProduct;
|
||||
_ProductItem(this.catalogProduct);
|
||||
}
|
||||
|
||||
final class _DishItem extends _ListItem {
|
||||
final DishSearchResult dish;
|
||||
_DishItem(this.dish);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Universal food tile
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class _FoodTile extends StatelessWidget {
|
||||
const _FoodTile({
|
||||
required this.leading,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final Widget leading;
|
||||
final String title;
|
||||
final String? subtitle;
|
||||
final VoidCallback onTap;
|
||||
|
||||
factory _FoodTile.fromProduct({
|
||||
required CatalogProduct catalogProduct,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
final calories = catalogProduct.caloriesPer100g;
|
||||
final parts = <String>[
|
||||
if (catalogProduct.categoryName != null) catalogProduct.categoryName!,
|
||||
if (calories != null) '${calories.toInt()} kcal/100g',
|
||||
];
|
||||
return _FoodTile(
|
||||
leading: CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.orange.shade50,
|
||||
child: const Icon(Icons.fastfood_outlined,
|
||||
size: 20, color: Colors.orange),
|
||||
),
|
||||
title: catalogProduct.displayName,
|
||||
subtitle: parts.isNotEmpty ? parts.join(' · ') : null,
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
|
||||
factory _FoodTile.fromDish({
|
||||
required DishSearchResult dish,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return _FoodTile(
|
||||
leading: dish.imageUrl != null
|
||||
? CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundImage: NetworkImage(dish.imageUrl!),
|
||||
)
|
||||
: CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: Colors.green.shade50,
|
||||
child: const Icon(Icons.restaurant,
|
||||
size: 20, color: Colors.green),
|
||||
),
|
||||
title: dish.name,
|
||||
subtitle: null,
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
|
||||
factory _FoodTile.fromRecent({
|
||||
required RecentDiaryItem recentItem,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
final calories = recentItem.displayCalories;
|
||||
final parts = <String>[
|
||||
if (recentItem.categoryName != null) recentItem.categoryName!,
|
||||
if (calories != null)
|
||||
recentItem.itemType == 'product'
|
||||
? '${calories.toInt()} kcal/100g'
|
||||
: '${calories.toInt()} kcal/serving',
|
||||
];
|
||||
return _FoodTile(
|
||||
leading: recentItem.imageUrl != null
|
||||
? CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundImage: NetworkImage(recentItem.imageUrl!),
|
||||
)
|
||||
: CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: recentItem.itemType == 'product'
|
||||
? Colors.orange.shade50
|
||||
: Colors.green.shade50,
|
||||
child: Icon(
|
||||
recentItem.itemType == 'product'
|
||||
? Icons.fastfood_outlined
|
||||
: Icons.restaurant,
|
||||
size: 20,
|
||||
color: recentItem.itemType == 'product'
|
||||
? Colors.orange
|
||||
: Colors.green,
|
||||
),
|
||||
),
|
||||
title: recentItem.name,
|
||||
subtitle: parts.isNotEmpty ? parts.join(' · ') : null,
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: leading,
|
||||
title: Text(title),
|
||||
subtitle: subtitle != null ? Text(subtitle!) : null,
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Dish portion sheet
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class _DishPortionSheet extends ConsumerStatefulWidget {
|
||||
const _DishPortionSheet({
|
||||
required this.dishId,
|
||||
required this.dishName,
|
||||
this.caloriesPerServing,
|
||||
required this.mealType,
|
||||
required this.date,
|
||||
required this.onAdded,
|
||||
});
|
||||
|
||||
final String dishId;
|
||||
final String dishName;
|
||||
final double? caloriesPerServing;
|
||||
final String mealType;
|
||||
final String date;
|
||||
final VoidCallback onAdded;
|
||||
|
||||
@override
|
||||
ConsumerState<_DishPortionSheet> createState() => _DishPortionSheetState();
|
||||
}
|
||||
|
||||
class _DishPortionSheetState extends ConsumerState<_DishPortionSheet> {
|
||||
double _selectedPortions = 1.0;
|
||||
bool _saving = false;
|
||||
late final TextEditingController _portionsController =
|
||||
TextEditingController(text: '1');
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_portionsController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _setPortions(double value) {
|
||||
setState(() {
|
||||
_selectedPortions = value;
|
||||
_portionsController.text = value % 1 == 0
|
||||
? value.toInt().toString()
|
||||
: value.toStringAsFixed(1);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _confirm() async {
|
||||
final parsed = double.tryParse(_portionsController.text);
|
||||
final portions =
|
||||
(parsed != null && parsed > 0) ? parsed : _selectedPortions;
|
||||
setState(() => _saving = true);
|
||||
try {
|
||||
await ref.read(apiClientProvider).post('/diary', data: {
|
||||
'dish_id': widget.dishId,
|
||||
'portions': portions,
|
||||
'meal_type': widget.mealType,
|
||||
'date': widget.date,
|
||||
'source': 'search',
|
||||
});
|
||||
widget.onAdded();
|
||||
} catch (_) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.addFailed),
|
||||
),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) setState(() => _saving = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final theme = Theme.of(context);
|
||||
final insets = MediaQuery.viewInsetsOf(context);
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, 16, 16, 16 + insets.bottom),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(widget.dishName, style: theme.textTheme.titleMedium),
|
||||
if (widget.caloriesPerServing != null)
|
||||
Text(
|
||||
'${widget.caloriesPerServing!.toInt()} kcal / serving',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Quick-select portion buttons
|
||||
Row(
|
||||
children: [
|
||||
for (final quickValue in [0.5, 1.0, 1.5, 2.0])
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: OutlinedButton(
|
||||
onPressed: () => _setPortions(quickValue),
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 8),
|
||||
side: BorderSide(
|
||||
color: _selectedPortions == quickValue
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.outline,
|
||||
width: _selectedPortions == quickValue ? 2 : 1,
|
||||
),
|
||||
),
|
||||
child: Text(quickValue % 1 == 0
|
||||
? quickValue.toInt().toString()
|
||||
: quickValue.toStringAsFixed(1)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
TextField(
|
||||
controller: _portionsController,
|
||||
keyboardType:
|
||||
const TextInputType.numberWithOptions(decimal: true),
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.servingsLabel,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
FilledButton(
|
||||
onPressed: _saving ? null : _confirm,
|
||||
child: _saving
|
||||
? const SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: Text(l10n.addToDiary),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import '../../core/theme/app_colors.dart';
|
||||
import '../../shared/models/diary_entry.dart';
|
||||
import '../../shared/models/home_summary.dart';
|
||||
import '../../shared/models/meal_type.dart';
|
||||
import '../diary/food_search_sheet.dart';
|
||||
import '../menu/menu_provider.dart';
|
||||
import '../profile/profile_provider.dart';
|
||||
import '../scan/dish_result_screen.dart';
|
||||
@@ -966,8 +967,21 @@ class _MealCard extends ConsumerWidget {
|
||||
icon: const Icon(Icons.add, size: 20),
|
||||
visualDensity: VisualDensity.compact,
|
||||
tooltip: l10n.addDish,
|
||||
onPressed: () => _pickAndShowDishResult(
|
||||
context, ref, mealTypeOption.id),
|
||||
onPressed: () {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
builder: (_) => FoodSearchSheet(
|
||||
mealType: mealTypeOption.id,
|
||||
date: dateString,
|
||||
onAdded: () => ref
|
||||
.invalidate(diaryProvider(dateString)),
|
||||
onScanDish: () => _pickAndShowDishResult(
|
||||
context, ref, mealTypeOption.id),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "وزن الحصة (جم)",
|
||||
"productNotFound": "المنتج غير موجود",
|
||||
"enterManually": "أدخل يدوياً",
|
||||
"perHundredG": "لكل 100 جم"
|
||||
"perHundredG": "لكل 100 جم",
|
||||
"searchFoodHint": "البحث عن المنتجات والأطباق...",
|
||||
"recentlyUsedLabel": "المستخدمة مؤخراً",
|
||||
"productsSection": "المنتجات",
|
||||
"dishesSection": "الأطباق",
|
||||
"noResultsForQuery": "لم يتم العثور على نتائج لـ \"{query}\"",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "حصص",
|
||||
"addToDiary": "إضافة إلى اليومية",
|
||||
"scanDishPhoto": "مسح الصورة"
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "Portionsgewicht (g)",
|
||||
"productNotFound": "Produkt nicht gefunden",
|
||||
"enterManually": "Manuell eingeben",
|
||||
"perHundredG": "pro 100 g"
|
||||
"perHundredG": "pro 100 g",
|
||||
"searchFoodHint": "Produkte und Gerichte suchen...",
|
||||
"recentlyUsedLabel": "Zuletzt verwendet",
|
||||
"productsSection": "Produkte",
|
||||
"dishesSection": "Gerichte",
|
||||
"noResultsForQuery": "Keine Ergebnisse für \"{query}\"",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "Portionen",
|
||||
"addToDiary": "Zum Tagebuch hinzufügen",
|
||||
"scanDishPhoto": "Foto scannen"
|
||||
}
|
||||
|
||||
@@ -108,5 +108,18 @@
|
||||
"portionWeightG": "Portion weight (g)",
|
||||
"productNotFound": "Product not found",
|
||||
"enterManually": "Enter manually",
|
||||
"perHundredG": "per 100 g"
|
||||
"perHundredG": "per 100 g",
|
||||
"searchFoodHint": "Search products and dishes...",
|
||||
"recentlyUsedLabel": "Recently used",
|
||||
"productsSection": "Products",
|
||||
"dishesSection": "Dishes",
|
||||
"noResultsForQuery": "Nothing found for \"{query}\"",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "Servings",
|
||||
"addToDiary": "Add to diary",
|
||||
"scanDishPhoto": "Scan photo"
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "Peso de la porción (g)",
|
||||
"productNotFound": "Producto no encontrado",
|
||||
"enterManually": "Ingresar manualmente",
|
||||
"perHundredG": "por 100 g"
|
||||
"perHundredG": "por 100 g",
|
||||
"searchFoodHint": "Buscar productos y platos...",
|
||||
"recentlyUsedLabel": "Usados recientemente",
|
||||
"productsSection": "Productos",
|
||||
"dishesSection": "Platos",
|
||||
"noResultsForQuery": "Nada encontrado para \"{query}\"",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "Porciones",
|
||||
"addToDiary": "Añadir al diario",
|
||||
"scanDishPhoto": "Escanear foto"
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "Poids de la portion (g)",
|
||||
"productNotFound": "Produit introuvable",
|
||||
"enterManually": "Saisir manuellement",
|
||||
"perHundredG": "pour 100 g"
|
||||
"perHundredG": "pour 100 g",
|
||||
"searchFoodHint": "Rechercher produits et plats...",
|
||||
"recentlyUsedLabel": "Récemment utilisés",
|
||||
"productsSection": "Produits",
|
||||
"dishesSection": "Plats",
|
||||
"noResultsForQuery": "Rien trouvé pour \"{query}\"",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "Portions",
|
||||
"addToDiary": "Ajouter au journal",
|
||||
"scanDishPhoto": "Scanner une photo"
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "हिस्से का वजन (ग्राम)",
|
||||
"productNotFound": "उत्पाद नहीं मिला",
|
||||
"enterManually": "मैन्युअल दर्ज करें",
|
||||
"perHundredG": "प्रति 100 ग्राम"
|
||||
"perHundredG": "प्रति 100 ग्राम",
|
||||
"searchFoodHint": "उत्पाद और व्यंजन खोजें...",
|
||||
"recentlyUsedLabel": "हाल ही में उपयोग किए गए",
|
||||
"productsSection": "उत्पाद",
|
||||
"dishesSection": "व्यंजन",
|
||||
"noResultsForQuery": "\"{query}\" के लिए कुछ नहीं मिला",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "सर्विंग",
|
||||
"addToDiary": "डायरी में जोड़ें",
|
||||
"scanDishPhoto": "फ़ोटो स्कैन करें"
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "Peso della porzione (g)",
|
||||
"productNotFound": "Prodotto non trovato",
|
||||
"enterManually": "Inserisci manualmente",
|
||||
"perHundredG": "per 100 g"
|
||||
"perHundredG": "per 100 g",
|
||||
"searchFoodHint": "Cerca prodotti e piatti...",
|
||||
"recentlyUsedLabel": "Usati di recente",
|
||||
"productsSection": "Prodotti",
|
||||
"dishesSection": "Piatti",
|
||||
"noResultsForQuery": "Nessun risultato per \"{query}\"",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "Porzioni",
|
||||
"addToDiary": "Aggiungi al diario",
|
||||
"scanDishPhoto": "Scansiona foto"
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "1食分の重さ(g)",
|
||||
"productNotFound": "商品が見つかりません",
|
||||
"enterManually": "手動で入力",
|
||||
"perHundredG": "100gあたり"
|
||||
"perHundredG": "100gあたり",
|
||||
"searchFoodHint": "食品と料理を検索...",
|
||||
"recentlyUsedLabel": "最近使用",
|
||||
"productsSection": "食品",
|
||||
"dishesSection": "料理",
|
||||
"noResultsForQuery": "「{query}」の検索結果はありません",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "人前",
|
||||
"addToDiary": "日記に追加",
|
||||
"scanDishPhoto": "写真をスキャン"
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "1회 제공량 (g)",
|
||||
"productNotFound": "제품을 찾을 수 없습니다",
|
||||
"enterManually": "직접 입력",
|
||||
"perHundredG": "100g당"
|
||||
"perHundredG": "100g당",
|
||||
"searchFoodHint": "식품 및 요리 검색...",
|
||||
"recentlyUsedLabel": "최근 사용",
|
||||
"productsSection": "식품",
|
||||
"dishesSection": "요리",
|
||||
"noResultsForQuery": "\"{query}\"에 대한 결과 없음",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "인분",
|
||||
"addToDiary": "일기에 추가",
|
||||
"scanDishPhoto": "사진 스캔"
|
||||
}
|
||||
|
||||
@@ -741,6 +741,54 @@ abstract class AppLocalizations {
|
||||
/// In en, this message translates to:
|
||||
/// **'per 100 g'**
|
||||
String get perHundredG;
|
||||
|
||||
/// No description provided for @searchFoodHint.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Search products and dishes...'**
|
||||
String get searchFoodHint;
|
||||
|
||||
/// No description provided for @recentlyUsedLabel.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Recently used'**
|
||||
String get recentlyUsedLabel;
|
||||
|
||||
/// No description provided for @productsSection.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Products'**
|
||||
String get productsSection;
|
||||
|
||||
/// No description provided for @dishesSection.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Dishes'**
|
||||
String get dishesSection;
|
||||
|
||||
/// No description provided for @noResultsForQuery.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Nothing found for \"{query}\"'**
|
||||
String noResultsForQuery(String query);
|
||||
|
||||
/// No description provided for @servingsLabel.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Servings'**
|
||||
String get servingsLabel;
|
||||
|
||||
/// No description provided for @addToDiary.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Add to diary'**
|
||||
String get addToDiary;
|
||||
|
||||
/// No description provided for @scanDishPhoto.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Scan photo'**
|
||||
String get scanDishPhoto;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
||||
@@ -322,4 +322,30 @@ class AppLocalizationsAr extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'لكل 100 جم';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'البحث عن المنتجات والأطباق...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'المستخدمة مؤخراً';
|
||||
|
||||
@override
|
||||
String get productsSection => 'المنتجات';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'الأطباق';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return 'لم يتم العثور على نتائج لـ \"$query\"';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'حصص';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'إضافة إلى اليومية';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'مسح الصورة';
|
||||
}
|
||||
|
||||
@@ -324,4 +324,30 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'pro 100 g';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'Produkte und Gerichte suchen...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'Zuletzt verwendet';
|
||||
|
||||
@override
|
||||
String get productsSection => 'Produkte';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'Gerichte';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return 'Keine Ergebnisse für \"$query\"';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'Portionen';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'Zum Tagebuch hinzufügen';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'Foto scannen';
|
||||
}
|
||||
|
||||
@@ -322,4 +322,30 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'per 100 g';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'Search products and dishes...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'Recently used';
|
||||
|
||||
@override
|
||||
String get productsSection => 'Products';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'Dishes';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return 'Nothing found for \"$query\"';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'Servings';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'Add to diary';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'Scan photo';
|
||||
}
|
||||
|
||||
@@ -324,4 +324,30 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'por 100 g';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'Buscar productos y platos...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'Usados recientemente';
|
||||
|
||||
@override
|
||||
String get productsSection => 'Productos';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'Platos';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return 'Nada encontrado para \"$query\"';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'Porciones';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'Añadir al diario';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'Escanear foto';
|
||||
}
|
||||
|
||||
@@ -325,4 +325,30 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'pour 100 g';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'Rechercher produits et plats...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'Récemment utilisés';
|
||||
|
||||
@override
|
||||
String get productsSection => 'Produits';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'Plats';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return 'Rien trouvé pour \"$query\"';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'Portions';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'Ajouter au journal';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'Scanner une photo';
|
||||
}
|
||||
|
||||
@@ -323,4 +323,30 @@ class AppLocalizationsHi extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'प्रति 100 ग्राम';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'उत्पाद और व्यंजन खोजें...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'हाल ही में उपयोग किए गए';
|
||||
|
||||
@override
|
||||
String get productsSection => 'उत्पाद';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'व्यंजन';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return '\"$query\" के लिए कुछ नहीं मिला';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'सर्विंग';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'डायरी में जोड़ें';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'फ़ोटो स्कैन करें';
|
||||
}
|
||||
|
||||
@@ -324,4 +324,30 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'per 100 g';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'Cerca prodotti e piatti...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'Usati di recente';
|
||||
|
||||
@override
|
||||
String get productsSection => 'Prodotti';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'Piatti';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return 'Nessun risultato per \"$query\"';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'Porzioni';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'Aggiungi al diario';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'Scansiona foto';
|
||||
}
|
||||
|
||||
@@ -321,4 +321,30 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => '100gあたり';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => '食品と料理を検索...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => '最近使用';
|
||||
|
||||
@override
|
||||
String get productsSection => '食品';
|
||||
|
||||
@override
|
||||
String get dishesSection => '料理';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return '「$query」の検索結果はありません';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => '人前';
|
||||
|
||||
@override
|
||||
String get addToDiary => '日記に追加';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => '写真をスキャン';
|
||||
}
|
||||
|
||||
@@ -321,4 +321,30 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => '100g당';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => '식품 및 요리 검색...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => '최근 사용';
|
||||
|
||||
@override
|
||||
String get productsSection => '식품';
|
||||
|
||||
@override
|
||||
String get dishesSection => '요리';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return '\"$query\"에 대한 결과 없음';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => '인분';
|
||||
|
||||
@override
|
||||
String get addToDiary => '일기에 추가';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => '사진 스캔';
|
||||
}
|
||||
|
||||
@@ -324,4 +324,30 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'por 100 g';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'Pesquisar produtos e pratos...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'Usados recentemente';
|
||||
|
||||
@override
|
||||
String get productsSection => 'Produtos';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'Pratos';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return 'Nada encontrado para \"$query\"';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'Porções';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'Adicionar ao diário';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'Escanear foto';
|
||||
}
|
||||
|
||||
@@ -322,4 +322,30 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => 'на 100 г';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => 'Поиск продуктов и блюд...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => 'Недавно использованные';
|
||||
|
||||
@override
|
||||
String get productsSection => 'Продукты';
|
||||
|
||||
@override
|
||||
String get dishesSection => 'Блюда';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return 'По запросу \"$query\" ничего не найдено';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => 'Порций';
|
||||
|
||||
@override
|
||||
String get addToDiary => 'Добавить в дневник';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => 'Сканировать фото';
|
||||
}
|
||||
|
||||
@@ -321,4 +321,30 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get perHundredG => '每100克';
|
||||
|
||||
@override
|
||||
String get searchFoodHint => '搜索产品和菜肴...';
|
||||
|
||||
@override
|
||||
String get recentlyUsedLabel => '最近使用';
|
||||
|
||||
@override
|
||||
String get productsSection => '产品';
|
||||
|
||||
@override
|
||||
String get dishesSection => '菜肴';
|
||||
|
||||
@override
|
||||
String noResultsForQuery(String query) {
|
||||
return '未找到 \"$query\" 的结果';
|
||||
}
|
||||
|
||||
@override
|
||||
String get servingsLabel => '份数';
|
||||
|
||||
@override
|
||||
String get addToDiary => '添加到日记';
|
||||
|
||||
@override
|
||||
String get scanDishPhoto => '扫描照片';
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "Peso da porção (g)",
|
||||
"productNotFound": "Produto não encontrado",
|
||||
"enterManually": "Inserir manualmente",
|
||||
"perHundredG": "por 100 g"
|
||||
"perHundredG": "por 100 g",
|
||||
"searchFoodHint": "Pesquisar produtos e pratos...",
|
||||
"recentlyUsedLabel": "Usados recentemente",
|
||||
"productsSection": "Produtos",
|
||||
"dishesSection": "Pratos",
|
||||
"noResultsForQuery": "Nada encontrado para \"{query}\"",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "Porções",
|
||||
"addToDiary": "Adicionar ao diário",
|
||||
"scanDishPhoto": "Escanear foto"
|
||||
}
|
||||
|
||||
@@ -108,5 +108,18 @@
|
||||
"portionWeightG": "Вес порции (г)",
|
||||
"productNotFound": "Продукт не найден",
|
||||
"enterManually": "Ввести вручную",
|
||||
"perHundredG": "на 100 г"
|
||||
"perHundredG": "на 100 г",
|
||||
"searchFoodHint": "Поиск продуктов и блюд...",
|
||||
"recentlyUsedLabel": "Недавно использованные",
|
||||
"productsSection": "Продукты",
|
||||
"dishesSection": "Блюда",
|
||||
"noResultsForQuery": "По запросу \"{query}\" ничего не найдено",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "Порций",
|
||||
"addToDiary": "Добавить в дневник",
|
||||
"scanDishPhoto": "Сканировать фото"
|
||||
}
|
||||
|
||||
@@ -110,5 +110,18 @@
|
||||
"portionWeightG": "份量(克)",
|
||||
"productNotFound": "未找到产品",
|
||||
"enterManually": "手动输入",
|
||||
"perHundredG": "每100克"
|
||||
"perHundredG": "每100克",
|
||||
"searchFoodHint": "搜索产品和菜肴...",
|
||||
"recentlyUsedLabel": "最近使用",
|
||||
"productsSection": "产品",
|
||||
"dishesSection": "菜肴",
|
||||
"noResultsForQuery": "未找到 \"{query}\" 的结果",
|
||||
"@noResultsForQuery": {
|
||||
"placeholders": {
|
||||
"query": { "type": "String" }
|
||||
}
|
||||
},
|
||||
"servingsLabel": "份数",
|
||||
"addToDiary": "添加到日记",
|
||||
"scanDishPhoto": "扫描照片"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user