feat: add utility functions for date and quantity formatting; refactor inventory and recipe screens to use new formatters
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../../core/api/api_error_mapper.dart';
|
||||
import '../../../core/api/api_exception.dart';
|
||||
import '../../../core/utils/formatters.dart';
|
||||
import '../../../core/api/api_paths.dart';
|
||||
import '../../../core/api/api_providers.dart';
|
||||
import '../../../core/forms/form_options.dart';
|
||||
@@ -31,13 +32,10 @@ class _EditableIngredient {
|
||||
noteCtrl = TextEditingController(text: note);
|
||||
|
||||
factory _EditableIngredient.fromRecipe(RecipeIngredient ingredient) {
|
||||
final quantity = ingredient.quantity == ingredient.quantity.truncateToDouble()
|
||||
? ingredient.quantity.toInt().toString()
|
||||
: ingredient.quantity.toString();
|
||||
return _EditableIngredient(
|
||||
productId: ingredient.productId,
|
||||
productName: ingredient.productName,
|
||||
quantity: quantity,
|
||||
quantity: formatQuantity(ingredient.quantity),
|
||||
unit: ingredient.unit,
|
||||
note: ingredient.note ?? '',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user