Repository: Pemuda-Pembuka-Langkah/pockeat-mobile
Pull request #383: REFACTOR: changed portion input method on food database input
Author: login: pesolosep
Created: 2025-05-21T14:24:42Z | Merged: 2025-05-21T14:32:35Z


![image](https://github.com/user-attachments/assets/cc633f52-ea76-49a2-a376-00c2c0b31584)


This pull request introduces significant updates to the `FoodItemCard` component, improves how portions are handled across the app, and includes a minor enhancement to the main application configuration. Below is a summary of the most important changes grouped by theme:

### FoodItemCard Enhancements:
* Converted `FoodItemCard` from a `StatelessWidget` to a `StatefulWidget` to manage state for user inputs such as portion size and count. Added a `_FoodItemCardState` class to handle state management. [[1]](diffhunk://#diff-7af5fe4dfad19d4e0f51f4fe852d7e76f040c9205fd5424e652c13eb196573b7L7-R7) [[2]](diffhunk://#diff-7af5fe4dfad19d4e0f51f4fe852d7e76f040c9205fd5424e652c13eb196573b7L28-R68)
* Introduced a `TextEditingController` for the portion input, with validation to ensure values are between 1 and 1000 grams. Added logic to reset invalid inputs to the last valid value.
* Updated UI elements to use `widget` properties for dynamic rendering, such as `widget.food`, `widget.primaryGreen`, and `widget.primaryPink`. [[1]](diffhunk://#diff-7af5fe4dfad19d4e0f51f4fe852d7e76f040c9205fd5424e652c13eb196573b7L58-R91) [[2]](diffhunk://#diff-7af5fe4dfad19d4e0f51f4fe852d7e76f040c9205fd5424e652c13eb196573b7L72-R102) [[3]](diffhunk://#diff-7af5fe4dfad19d4e0f51f4fe852d7e76f040c9205fd5424e652c13eb196573b7L93-R122) [[4]](diffhunk://#diff-7af5fe4dfad19d4e0f51f4fe852d7e76f040c9205fd5424e652c13eb196573b7L110-R141)
* Replaced the slider for portion selection with a text input field for better precision. Added helper text to guide users on valid input ranges. [[1]](diffhunk://#diff-7af5fe4dfad19d4e0f51f4fe852d7e76f040c9205fd5424e652c13eb196573b7L121-R260) [[2]](diffhunk://#diff-7af5fe4dfad19d4e0f51f4fe852d7e76f040c9205fd5424e652c13eb196573b7L190-L267)

### Portion Handling Improvements:
* Standardized the initial portion value to always default to 100.0 grams when adding a new food item. Removed logic that depended on ingredient servings. [[1]](diffhunk://#diff-021b4c67afb831bb4688e669ef774d5b563df54a22dee51fadf6f4e8f0e4b9ddL86-R89) [[2]](diffhunk://#diff-d084942f9c7e4313610d7c119beb49023af503500706daed5d2f69d8921f58ddL118-R120)

### Application Configuration:
* Disabled the debug banner in the `MaterialApp` configuration for a cleaner UI in production.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Portion size for food items can now be edited directly in the interface using an input field, allowing users to specify values between 1 and 1000 grams.
  - Helper text guides users on valid portion size entry.

- **Improvements**
  - Default portion size is now consistently set to 100 grams for all new food selections.
  - Updated layout for food item cards, providing clearer and more consistent input fields for both count and portion size.
  - The debug banner is now hidden during development for a cleaner app appearance.

- **Bug Fixes**
  - Improved validation for portion size input to prevent invalid entries.

- **Chores**
  - Removed comprehensive widget tests for the selected foods tab.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/lib/features/food_database_input/presentation/food_database_page.dart b/lib/features/food_database_input/presentation/food_database_page.dart
index ec085cdd..1e686b41 100644
--- a/lib/features/food_database_input/presentation/food_database_page.dart
+++ b/lib/features/food_database_input/presentation/food_database_page.dart
@@ -83,13 +83,10 @@ class _NutritionDatabasePageState extends State<NutritionDatabasePage>
 
   void _addFoodToSelection(FoodAnalysisResult food) {
     setState(() {
-      _selectedFoods.add(food);
-
-      // Initialize portion value for the new food
+      _selectedFoods.add(
+          food); // Initialize portion value for the new food - always use 100.0 grams
       final index = _selectedFoods.length - 1;
-      final initialPortion =
-          food.ingredients.isNotEmpty ? food.ingredients[0].servings : 100.0;
-      _portionValues[index] = initialPortion;
+      _portionValues[index] = 100.0;
 
       // Add a new component count controller
       _componentCountControllers.add(TextEditingController(text: "1"));
diff --git a/lib/features/food_database_input/presentation/widgets/food_item_card.dart b/lib/features/food_database_input/presentation/widgets/food_item_card.dart
index cb8bb907..fed7d4f6 100644
--- a/lib/features/food_database_input/presentation/widgets/food_item_card.dart
+++ b/lib/features/food_database_input/presentation/widgets/food_item_card.dart
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
 // Project imports:
 import 'package:pockeat/features/api_scan/models/food_analysis.dart';
 
-class FoodItemCard extends StatelessWidget {
+class FoodItemCard extends StatefulWidget {
   final FoodAnalysisResult food;
   final int index;
   final double portion;
@@ -25,18 +25,47 @@ class FoodItemCard extends StatelessWidget {
     required this.primaryGreen,
     required this.primaryPink,
   });
-  // Helper method to build marker labels
-  Widget _buildMarker(String text) {
-    return Text(
-      text,
-      style: TextStyle(
-        fontSize: 10,
-        color: Colors.grey[600],
-        fontWeight: text == '10g' || text == '500g'
-            ? FontWeight.bold
-            : FontWeight.normal,
-      ),
-    );
+
+  @override
+  State<FoodItemCard> createState() => _FoodItemCardState();
+}
+
+class _FoodItemCardState extends State<FoodItemCard> {
+  // Controller for the portion input
+  late TextEditingController _portionController;
+
+  @override
+  void initState() {
+    super.initState();
+    _portionController =
+        TextEditingController(text: widget.portion.toStringAsFixed(0));
+  }
+
+  @override
+  void didUpdateWidget(FoodItemCard oldWidget) {
+    super.didUpdateWidget(oldWidget);
+    if (oldWidget.portion != widget.portion) {
+      _portionController.text = widget.portion.toStringAsFixed(0);
+    }
+  }
+
+  @override
+  void dispose() {
+    _portionController.dispose();
+    super.dispose();
+  }
+
+  // Helper method to update the portion value
+  void _updatePortionValue() {
+    if (_portionController.text.isNotEmpty) {
+      int? intValue = int.tryParse(_portionController.text);
+      if (intValue != null && intValue >= 1 && intValue <= 1000) {
+        widget.onPortionChanged(widget.index, intValue.toDouble());
+      } else {
+        // Reset to valid value if entered value is invalid
+        _portionController.text = widget.portion.toStringAsFixed(0);
+      }
+    }
   }
 
   @override
@@ -55,11 +84,11 @@ class FoodItemCard extends StatelessWidget {
             // Food header with name and delete button
             Row(
               children: [
-                Icon(Icons.restaurant, size: 16, color: primaryGreen),
+                Icon(Icons.restaurant, size: 16, color: widget.primaryGreen),
                 const SizedBox(width: 8),
                 Expanded(
                   child: Text(
-                    food.foodName,
+                    widget.food.foodName,
                     style: const TextStyle(
                       fontWeight: FontWeight.bold,
                       fontSize: 16,
@@ -69,8 +98,8 @@ class FoodItemCard extends StatelessWidget {
                   ),
                 ),
                 IconButton(
-                  icon: Icon(Icons.delete_outline, color: primaryPink),
-                  onPressed: () => onRemove(index),
+                  icon: Icon(Icons.delete_outline, color: widget.primaryPink),
+                  onPressed: () => widget.onRemove(widget.index),
                   padding: EdgeInsets.zero,
                   constraints: const BoxConstraints(),
                   iconSize: 20,
@@ -90,7 +119,7 @@ class FoodItemCard extends StatelessWidget {
                     children: [
                       TextSpan(
                         text:
-                            '${food.nutritionInfo.calories.toStringAsFixed(0)} ',
+                            '${widget.food.nutritionInfo.calories.toStringAsFixed(0)} ',
                         style: const TextStyle(
                           fontWeight: FontWeight.bold,
                           fontSize: 18,
@@ -107,9 +136,9 @@ class FoodItemCard extends StatelessWidget {
                   ),
                 ),
                 Text(
-                  'P: ${food.nutritionInfo.protein.toStringAsFixed(1)}g • '
-                  'C: ${food.nutritionInfo.carbs.toStringAsFixed(1)}g • '
-                  'F: ${food.nutritionInfo.fat.toStringAsFixed(1)}g',
+                  'P: ${widget.food.nutritionInfo.protein.toStringAsFixed(1)}g • '
+                  'C: ${widget.food.nutritionInfo.carbs.toStringAsFixed(1)}g • '
+                  'F: ${widget.food.nutritionInfo.fat.toStringAsFixed(1)}g',
                   style: TextStyle(
                     fontSize: 12,
                     color: Colors.grey[700],
@@ -118,152 +147,140 @@ class FoodItemCard extends StatelessWidget {
               ],
             ),
 
-            const SizedBox(height: 16),
-
-            // Portion row with count input
+            const SizedBox(height: 16), // Portion and count inputs in a row
             Row(
               children: [
-                Text(
-                  'Portion:',
-                  style: TextStyle(
-                    fontSize: 14,
-                    color: Colors.grey[700],
-                  ),
-                ),
-                const SizedBox(width: 6),
-                Container(
-                  padding:
-                      const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
-                  decoration: BoxDecoration(
-                    color: primaryGreen.withOpacity(0.1),
-                    borderRadius: BorderRadius.circular(4),
-                  ),
-                  child: Text(
-                    '${portion.toStringAsFixed(1)}g',
-                    style: TextStyle(
-                      fontWeight: FontWeight.bold,
-                      color: primaryGreen,
-                    ),
-                  ),
-                ),
-                const Spacer(),
-                Text(
-                  'Count:',
-                  style: TextStyle(
-                    fontSize: 14,
-                    color: Colors.grey[700],
-                  ),
-                ),
-                const SizedBox(width: 6),
-                SizedBox(
-                  width: 50,
-                  height: 32,
-                  child: TextFormField(
-                    controller: countController,
-                    keyboardType: TextInputType.number,
-                    textAlign: TextAlign.center,
-                    decoration: InputDecoration(
-                      contentPadding: const EdgeInsets.symmetric(
-                        vertical: 6,
-                        horizontal: 8,
-                      ),
-                      isDense: true,
-                      border: OutlineInputBorder(
-                        borderRadius: BorderRadius.circular(4),
-                        borderSide: BorderSide(color: primaryGreen),
+                // Count input
+                Expanded(
+                  flex: 1,
+                  child: Column(
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    children: [
+                      Text(
+                        'Count:',
+                        style: TextStyle(
+                          fontSize: 14,
+                          color: Colors.grey[700],
+                        ),
                       ),
-                      focusedBorder: OutlineInputBorder(
-                        borderRadius: BorderRadius.circular(4),
-                        borderSide: BorderSide(color: primaryGreen, width: 2),
+                      const SizedBox(height: 6),
+                      SizedBox(
+                        height: 40,
+                        child: TextFormField(
+                          controller: widget.countController,
+                          keyboardType: TextInputType.number,
+                          textAlign: TextAlign.center,
+                          decoration: InputDecoration(
+                            contentPadding: const EdgeInsets.symmetric(
+                              vertical: 10,
+                              horizontal: 8,
+                            ),
+                            isDense: true,
+                            border: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide:
+                                  BorderSide(color: widget.primaryGreen),
+                            ),
+                            focusedBorder: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide: BorderSide(
+                                  color: widget.primaryGreen, width: 2),
+                            ),
+                            counter: const SizedBox.shrink(),
+                          ),
+                          maxLength: 2,
+                          // No real-time updates - only update when editing is complete
+                          onEditingComplete: () {
+                            FocusScope.of(context).unfocus();
+                            // Calculation will happen when the focus is lost
+                          },
+                          style: const TextStyle(
+                            fontSize: 14,
+                            fontWeight: FontWeight.bold,
+                          ),
+                        ),
                       ),
-                      counter: const SizedBox.shrink(),
-                    ),
-                    maxLength: 2,
-                    style: const TextStyle(
-                      fontSize: 14,
-                      fontWeight: FontWeight.bold,
-                    ),
+                    ],
                   ),
                 ),
-              ],
-            ),
 
-            const SizedBox(
-                height:
-                    12), // Centered slider (improved touch target with fixed center thumb)
-            Container(
-              padding:
-                  const EdgeInsets.symmetric(vertical: 12.0, horizontal: 4.0),
-              margin: const EdgeInsets.symmetric(vertical: 8.0),
-              decoration: BoxDecoration(
-                color: Colors.grey.withOpacity(0.05),
-                borderRadius: BorderRadius.circular(16),
-                border: Border.all(color: Colors.grey.withOpacity(0.1)),
-              ),
-              child: Column(
-                children: [
-                  // Slider usage hint
-                  Padding(
-                    padding: const EdgeInsets.only(bottom: 8.0),
-                    child: Text(
-                      'Hold and Drag slider to adjust portion',
-                      style: TextStyle(
-                        fontSize: 12,
-                        color: Colors.grey[600],
-                        fontStyle: FontStyle.italic,
-                      ),
-                      textAlign: TextAlign.center,
-                    ),
-                  ), // Standard Flutter Slider with enhanced appearance
-                  SliderTheme(
-                    data: const SliderThemeData(
-                      trackHeight: 4.0,
-                      thumbShape: RoundSliderThumbShape(
-                        enabledThumbRadius: 12.0,
-                        pressedElevation: 8.0,
-                      ),
-                      overlayShape: RoundSliderOverlayShape(
-                        overlayRadius: 24.0,
-                      ),
-                      tickMarkShape: RoundSliderTickMarkShape(
-                        tickMarkRadius: 2.0,
+                const SizedBox(width: 16),
+
+                // Portion input
+                Expanded(
+                  flex: 2,
+                  child: Column(
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    children: [
+                      Text(
+                        'Portion (grams):',
+                        style: TextStyle(
+                          fontSize: 14,
+                          color: Colors.grey[700],
+                        ),
                       ),
-                      showValueIndicator: ShowValueIndicator.always,
-                      valueIndicatorShape: PaddleSliderValueIndicatorShape(),
-                      valueIndicatorTextStyle: TextStyle(
-                        color: Colors.white,
-                        fontSize: 14.0,
-                        fontWeight: FontWeight.bold,
+                      const SizedBox(height: 6),
+                      SizedBox(
+                        height: 40,
+                        child: TextFormField(
+                          controller: _portionController,
+                          keyboardType: TextInputType.number,
+                          textAlign: TextAlign.center,
+                          decoration: InputDecoration(
+                            contentPadding: const EdgeInsets.symmetric(
+                              vertical: 10,
+                              horizontal: 8,
+                            ),
+                            isDense: true,
+                            suffixText: 'g',
+                            suffixStyle: TextStyle(
+                              color: widget.primaryGreen,
+                              fontWeight: FontWeight.bold,
+                            ),
+                            border: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide:
+                                  BorderSide(color: widget.primaryGreen),
+                            ),
+                            focusedBorder: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide: BorderSide(
+                                  color: widget.primaryGreen, width: 2),
+                            ),
+                            counter: const SizedBox.shrink(),
+                          ),
+                          maxLength: 4,
+                          // Update only when user is done editing
+                          onEditingComplete: () {
+                            FocusScope.of(context).unfocus();
+                            _updatePortionValue();
+                          },
+                          onFieldSubmitted: (_) {
+                            _updatePortionValue();
+                          },
+                          style: const TextStyle(
+                            fontSize: 14,
+                            fontWeight: FontWeight.bold,
+                          ),
+                        ),
                       ),
-                    ),
-                    child: Slider(
-                      min: 10,
-                      max: 500,
-                      value: portion,
-                      divisions: 49,
-                      activeColor: primaryGreen,
-                      inactiveColor: primaryGreen.withOpacity(0.2),
-                      label: '${portion.toStringAsFixed(0)}g',
-                      onChanged: (value) => onPortionChanged(index, value),
-                    ),
+                    ],
                   ),
+                ),
+              ],
+            ),
 
-                  // Key markers for better understanding of the scale
-                  Padding(
-                    padding: const EdgeInsets.only(
-                        top: 4.0, left: 12.0, right: 12.0),
-                    child: Row(
-                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                      children: [
-                        _buildMarker('10g'),
-                        _buildMarker('100g'),
-                        _buildMarker('250g'),
-                        _buildMarker('400g'),
-                        _buildMarker('500g'),
-                      ],
-                    ),
-                  ),
-                ],
+            // Helper text
+            Padding(
+              padding: const EdgeInsets.only(top: 8.0),
+              child: Text(
+                'Enter portion size (1-1000 grams)',
+                style: TextStyle(
+                  fontSize: 12,
+                  color: Colors.grey[600],
+                  fontStyle: FontStyle.italic,
+                ),
+                textAlign: TextAlign.center,
               ),
             ),
 
diff --git a/lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart b/lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart
index be7c59da..aca5365c 100644
--- a/lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart
+++ b/lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart
@@ -115,12 +115,9 @@ class SelectedFoodsTab extends StatelessWidget {
                     : ListView.builder(
                         itemCount: selectedFoods.length,
                         itemBuilder: (context, index) {
-                          final food = selectedFoods[index];
-                          // coverage:ignore-line
-                          final portion = portionValues[index] ??
-                              (food.ingredients.isNotEmpty
-                                  ? food.ingredients[0].servings
-                                  : 100.0);
+                          final food = selectedFoods[
+                              index]; // Always default to 100.0 grams if no value exists
+                          final portion = portionValues[index] ?? 100.0;
 
                           return FoodItemCard(
                             food: food,
diff --git a/lib/main.dart b/lib/main.dart
index 431685f4..a6c4bf39 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -497,6 +497,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
         Provider.of<NavigationProvider>(context, listen: false);
 
     return MaterialApp(
+      debugShowCheckedModeBanner: false,
       navigatorKey: navigatorKey,
       title: 'Pockeat',
       // Add observer to track route changes and update bottom navigation
diff --git a/test/features/food_database_input/presentation/widgets/selected_foods_tab_test.dart b/test/features/food_database_input/presentation/widgets/selected_foods_tab_test.dart
deleted file mode 100644
index 2167ba80..00000000
--- a/test/features/food_database_input/presentation/widgets/selected_foods_tab_test.dart
+++ /dev/null
@@ -1,291 +0,0 @@
-// Flutter imports:
-import 'package:flutter/material.dart';
-
-// Package imports:
-import 'package:flutter_test/flutter_test.dart';
-import 'package:mocktail/mocktail.dart';
-
-// Project imports:
-import 'package:pockeat/features/api_scan/models/food_analysis.dart';
-import 'package:pockeat/features/food_database_input/presentation/widgets/selected_foods_tab.dart';
-
-class MockCallbackFunction extends Mock {
-  void call();
-}
-
-class MockRemoveFoodCallback extends Mock {
-  void call(int index);
-}
-
-class MockAdjustPortionCallback extends Mock {
-  void call(int index, double grams);
-}
-
-void main() {
-  // Test colors
-  const Color primaryYellow = Color(0xFFFFE893);
-  const Color primaryPink = Color(0xFFFF6B6B);
-  const Color primaryGreen = Color(0xFF4ECDC4);
-
-  // Mock callbacks
-  late MockCallbackFunction mockOnCreateMeal;
-  late MockCallbackFunction mockOnClearAll;
-  late MockCallbackFunction mockOnGoToSearchTab;
-  late MockRemoveFoodCallback mockOnRemoveFood;
-  late MockAdjustPortionCallback mockOnAdjustPortion;
-
-  // Test data
-  late List<FoodAnalysisResult> testSelectedFoods;
-  late List<TextEditingController> componentCountControllers;
-  late Map<int, double> portionValues;
-  late TextEditingController mealNameController;
-  late GlobalKey<FormState> formKey;
-
-  setUp(() {
-    mockOnCreateMeal = MockCallbackFunction();
-    mockOnClearAll = MockCallbackFunction();
-    mockOnGoToSearchTab = MockCallbackFunction();
-    mockOnRemoveFood = MockRemoveFoodCallback();
-    mockOnAdjustPortion = MockAdjustPortionCallback();
-
-    mealNameController = TextEditingController();
-    formKey = GlobalKey<FormState>();
-
-    componentCountControllers = [
-      TextEditingController(text: '1'),
-      TextEditingController(text: '1')
-    ];
-
-    portionValues = {0: 100.0, 1: 100.0};
-
-    testSelectedFoods = [
-      FoodAnalysisResult(
-        id: 'food_1',
-        foodName: 'Apple',
-        ingredients: [Ingredient(name: 'Apple', servings: 52)],
-        nutritionInfo: NutritionInfo(
-          calories: 52,
-          protein: 0.3,
-          carbs: 14,
-          fat: 0.2,
-          sodium: 1,
-          fiber: 2.4,
-          sugar: 10.4,
-        ),
-        warnings: [],
-      ),
-      FoodAnalysisResult(
-        id: 'food_2',
-        foodName: 'Banana',
-        ingredients: [Ingredient(name: 'Banana', servings: 89)],
-        nutritionInfo: NutritionInfo(
-          calories: 89,
-          protein: 1.1,
-          carbs: 23,
-          fat: 0.3,
-          sodium: 1,
-          fiber: 2.6,
-          sugar: 12.2,
-        ),
-        warnings: [],
-      ),
-    ];
-  });
-
-  tearDown(() {
-    mealNameController.dispose();
-    for (var controller in componentCountControllers) {
-      controller.dispose();
-    }
-  });
-
-  Widget buildTestableWidget(
-      {List<FoodAnalysisResult> selectedFoods = const []}) {
-    return MaterialApp(
-      home: Scaffold(
-        body: SelectedFoodsTab(
-          mealNameController: mealNameController,
-          selectedFoods: selectedFoods,
-          componentCountControllers: componentCountControllers,
-          portionValues: portionValues,
-          formKey: formKey,
-          onCreateMeal: mockOnCreateMeal,
-          onClearAll: mockOnClearAll,
-          onRemoveFood: mockOnRemoveFood,
-          onAdjustPortion: mockOnAdjustPortion,
-          onGoToSearchTab: mockOnGoToSearchTab,
-          primaryYellow: primaryYellow,
-          primaryPink: primaryPink,
-          primaryGreen: primaryGreen,
-        ),
-      ),
-    );
-  }
-
-  group('SelectedFoodsTab', () {
-    testWidgets('should show empty state when no foods are selected',
-        (WidgetTester tester) async {
-      await tester.pumpWidget(buildTestableWidget());
-
-      expect(find.text('No foods selected yet'), findsOneWidget);
-      expect(find.text('Search Foods'), findsOneWidget);
-    });
-
-    testWidgets(
-        'should call onGoToSearchTab when button is pressed in empty state',
-        (WidgetTester tester) async {
-      await tester.pumpWidget(buildTestableWidget());
-
-      // Find and tap the button directly by text
-      await tester.tap(find.text('Search Foods'));
-      await tester.pump();
-
-      verify(mockOnGoToSearchTab).called(1);
-    });
-
-    testWidgets('should display selected foods when provided',
-        (WidgetTester tester) async {
-      await tester
-          .pumpWidget(buildTestableWidget(selectedFoods: testSelectedFoods));
-
-      // Check food items are displayed
-      expect(find.text('Apple'), findsOneWidget);
-      expect(find.text('Banana'), findsOneWidget);
-
-      // Find the RichTexts which contain the nutrition info
-      final richTextWidgets = find.byType(RichText);
-      expect(richTextWidgets, findsWidgets);
-
-      // Check for any widget that has the calories - they're in a RichText widget
-      expect(find.byWidgetPredicate((widget) {
-        if (widget is RichText) {
-          final String text = widget.text.toPlainText();
-          return text.contains('52');
-        }
-        return false;
-      }), findsOneWidget);
-
-      expect(find.byWidgetPredicate((widget) {
-        if (widget is RichText) {
-          final String text = widget.text.toPlainText();
-          return text.contains('89');
-        }
-        return false;
-      }), findsOneWidget);
-    });
-
-    testWidgets('should have meal name input field',
-        (WidgetTester tester) async {
-      await tester
-          .pumpWidget(buildTestableWidget(selectedFoods: testSelectedFoods));
-
-      // Find the meal name text field (there's only one TextFormField with this label)
-      final mealNameField = find.widgetWithText(TextFormField, 'Meal Name');
-      expect(mealNameField, findsOneWidget);
-
-      await tester.enterText(mealNameField, 'My Test Meal');
-      expect(mealNameController.text, 'My Test Meal');
-    });
-
-    testWidgets('should call onCreateMeal when Create Meal button is pressed',
-        (WidgetTester tester) async {
-      await tester
-          .pumpWidget(buildTestableWidget(selectedFoods: testSelectedFoods));
-
-      // Enter meal name
-      final mealNameField = find.widgetWithText(TextFormField, 'Meal Name');
-      await tester.enterText(mealNameField, 'My Test Meal');
-
-      // Find and tap create meal button by text directly
-      await tester.tap(find.text('Create Meal'));
-      await tester.pumpAndSettle();
-
-      verify(mockOnCreateMeal).called(1);
-    });
-
-    testWidgets('should call onClearAll when Clear button is pressed',
-        (WidgetTester tester) async {
-      await tester
-          .pumpWidget(buildTestableWidget(selectedFoods: testSelectedFoods));
-
-      // Find and tap clear button by text directly
-      await tester.tap(find.text('Clear'));
-      await tester.pumpAndSettle();
-
-      verify(mockOnClearAll).called(1);
-    });
-
-    testWidgets(
-        'should call onRemoveFood when remove button on food item is pressed',
-        (WidgetTester tester) async {
-      await tester
-          .pumpWidget(buildTestableWidget(selectedFoods: testSelectedFoods));
-
-      // Find and tap first delete icon (delete_outline in the implementation, not delete)
-      final removeButtons = find.byIcon(Icons.delete_outline);
-      expect(removeButtons, findsNWidgets(2)); // Should have one for each food
-
-      await tester.tap(removeButtons.first);
-      await tester.pumpAndSettle();
-
-      // Should have called with index 0 (first item)
-      verify(() => mockOnRemoveFood(0)).called(1);
-    });
-
-    testWidgets('should have portion adjustment sliders',
-        (WidgetTester tester) async {
-      await tester
-          .pumpWidget(buildTestableWidget(selectedFoods: testSelectedFoods));
-
-      // Find the sliders
-      final sliders = find.byType(Slider);
-      expect(sliders, findsNWidgets(2)); // Should have one for each food
-    });
-
-    testWidgets('should call onAdjustPortion when slider value changes',
-        (WidgetTester tester) async {
-      await tester
-          .pumpWidget(buildTestableWidget(selectedFoods: testSelectedFoods));
-
-      // Reset any previous interactions
-      reset(mockOnAdjustPortion);
-
-      // Find all sliders
-      final sliders = find.byType(Slider);
-      expect(sliders, findsNWidgets(2));
-
-      // Get the first slider for testing
-      final slider = tester.widget<Slider>(sliders.first);
-
-      // Simulate slider value change by directly calling onChanged callback
-      slider.onChanged!(200.0); // Use a new value different from the default
-      await tester.pumpAndSettle();
-
-      // Verify onAdjustPortion was called with index 0 and any value
-      verify(() => mockOnAdjustPortion(0, any())).called(1);
-    });
-
-    testWidgets('should have count input fields for each food',
-        (WidgetTester tester) async {
-      await tester
-          .pumpWidget(buildTestableWidget(selectedFoods: testSelectedFoods));
-
-      // Find count labels
-      final countLabels = find.text('Count:');
-      expect(countLabels, findsNWidgets(2)); // One for each food
-
-      // Verify there are text fields for component counts
-      final textFormFields = find.byType(TextFormField);
-
-      // There should be at least 3 TextFormFields (1 meal name + 2 count fields)
-      expect(textFormFields, findsAtLeastNWidgets(3));
-
-      // Verify count controllers are properly hooked up by updating first controller
-      componentCountControllers[0].text = '2';
-      await tester.pump();
-
-      // Verify the text was updated
-      expect(componentCountControllers[0].text, '2');
-    });
-  });
-}


Reviews:
user: login: DwikyAhmad
body: oke, sudah bagus
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-21T14:26:37Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 5**

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: ASSERTIVE**
**Plan: Pro**
**Cache: Disabled due to data retention organization setting**
**Knowledge Base: Disabled due to data retention organization setting**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between e88e336f396d59a67c7cf1ac3e2d016c344f7771 and 029f7ba1eee12ccd1e9ddde5d44589746de14e23.

</details>

<details>
<summary>📒 Files selected for processing (4)</summary>

* `lib/features/food_database_input/presentation/food_database_page.dart` (1 hunks)
* `lib/features/food_database_input/presentation/widgets/food_item_card.dart` (7 hunks)
* `lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart` (1 hunks)
* `lib/main.dart` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>📓 Path-based instructions (1)</summary>

<details>
<summary>`**/*.dart`: Selain review default dan issue pada kode, Review kode juga perlu berdasarkan prinsip lanjutan dengan fokus pada pengembangan berkelanjutan dan maintenance (OOP Princi...</summary>

> `**/*.dart`: Selain review default dan issue pada kode, Review kode juga perlu berdasarkan prinsip lanjutan dengan fokus pada pengembangan berkelanjutan dan maintenance (OOP Principle, Good Data Structure, SOLID Principle, Design Pattern):
> 
> 1. OOP Principles:
>    - Encapsulation: Pastikan state internal objek disembunyikan dan diakses melalui getter/setter yang tepat
>    - Inheritance: Verifikasi penggunaan extends/implements yang tepat, hindari deep inheritance
>    - Polymorphism: Cek penggunaan interface dan abstract class yang konsisten
>    - Abstraction: Identifikasi apakah detail implementasi tersembunyi dengan baik
> 
> 2. Good Data Structure:
>    - Pastikan pemilihan struktur data efisien (List, Map, Set)
>    - Cek immutability pada data yang tidak perlu berubah (final, const)
>    - Verifikasi penggunaan strong typing vs dynamic
>    - Validasi null safety implementation
> 
> 3. SOLID Principles:
>    - Single Responsibility: Setiap class memiliki satu alasan untuk berubah
>    - Open/Closed: Class terbuka untuk ekstensi tapi tertutup untuk modifikasi
>    - Liskov Substitution: Subclass dapat menggantikan parent tanpa breaking changes
>    - Interface Segregation: Client tidak dipaksa bergantung pada interface yang tidak digunakan
>    - Dependency Inversion: High-level modules tidak bergantung pada low-level modules
> 
> 4. Design Patterns:
>    - Creational Patterns:
>      * Factory/Abstract Factory: Untuk pembuatan objek tanpa menentukan class konkret
>      * Builder: Untuk konstruksi objek kompleks step-by-step
>      * Singleton: Untuk memastikan class memiliki hanya satu instance
>      * Dependency Injection: Untuk inversion of control
>    
>    - Structural Patterns:
>      * Adapter: Untuk mengkonversi interface class agar kompatibel dengan class lain
>      * Decorator: Untuk menambah fungsionalitas tanpa inheritance
>      * Composite: Untuk komposisi hierarki tree-like
>      * Proxy: Untuk control akses ke objek
>      * Bridge: Untuk memisahkan abstraksi dari implementasi
>      * Facade: Untuk menyederhanakan interface kompleks
>    
>    - Behavioral Patterns:
>      * Observer/Stream: Untuk reactive programming
>      * Strategy: Untuk menukar algoritma secara runtime
>      * Command: Untuk encapsulation request sebagai objek
>      * State: Untuk mengubah behavior saat state berubah
>      * Mediator: Untuk komunikasi terpusat antar objek
>      * Chain of Responsibility: Untuk passing request di chain handler
>    
>    - Architectural Patterns:
>      * Repository: Untuk abstraksi data access
>      * Service: Untuk encapsulation business logic
>      * BLoC/Provider/Redux: Untuk state management
>      * MVC/MVVM/MVP: Untuk separation of concerns
> 
> Berikan contoh konkret ketika menemukan pelanggaran dan jelaskan bagaimana ini dapat mempengaruhi maintenance jangka panjang.

- `lib/features/food_database_input/presentation/food_database_page.dart`
- `lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart`
- `lib/features/food_database_input/presentation/widgets/food_item_card.dart`
- `lib/main.dart`

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: Tests & Analysis

</details>

<details>
<summary>🔇 Additional comments (3)</summary><blockquote>

<details>
<summary>lib/main.dart (1)</summary>

`499-502`: **Debug banner correctly disabled for production-like builds**  

Adding `debugShowCheckedModeBanner: false` is a safe, one-liner quality-of-life tweak.  No runtime or architectural impact spotted.

</details>
<details>
<summary>lib/features/food_database_input/presentation/widgets/food_item_card.dart (2)</summary>

`7-31`: **Stateful refactor looks solid**  

Moving from `StatelessWidget` to `StatefulWidget` with a private controller is necessary for in-field editing and is implemented correctly (constructor parameters remain immutable, controller disposed in `dispose`).

---

`150-204`: **`count` field capped at 2 digits**  

`maxLength: 2` limits counts to 99.  If a meal could contain >99 identical items (edge-case but technically possible), users are blocked.  Verify the business rule; otherwise change to `3` or remove the cap and validate in the parent instead.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-21T14:27:56Z
user: login: isaui
body: Implementasi sudah baik tetapi tolong kedepannya clean code lebih diperhatikan ya
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-26T13:57:01Z

Review comments:
diff_hunk: @@ -115,12 +115,9 @@ class SelectedFoodsTab extends StatelessWidget {
                     : ListView.builder(
                         itemCount: selectedFoods.length,
                         itemBuilder: (context, index) {
-                          final food = selectedFoods[index];
-                          // coverage:ignore-line
-                          final portion = portionValues[index] ??
-                              (food.ingredients.isNotEmpty
-                                  ? food.ingredients[0].servings
-                                  : 100.0);
+                          final food = selectedFoods[
+                              index]; // Always default to 100.0 grams if no value exists
+                          final portion = portionValues[index] ?? 100.0;
 
path: lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**Hard-coding default to 100 g may reduce accuracy**  

Previous logic attempted to honour a food’s first‐ingredient serving size.  Always defaulting to `100.0` grams simplifies the flow but may surprise users if the nutrition label reports calories per e.g. 25 g serving.  
  

```diff
- final portion = portionValues[index] ?? 100.0;
+ // Prefer declared serving size, fall back to 100 g
+ final portion = portionValues[index] ??
+     (food.ingredients.isNotEmpty ? food.ingredients.first.servings : 100.0);
```  

Consider exposing this rule as a helper so both `SelectedFoodsTab` and `NutritionDatabasePage` share a single source of truth.  


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
                          final food = selectedFoods[
                              index]; // Always default to 100.0 grams if no value exists
                          // Prefer declared serving size, fall back to 100 g
                          final portion = portionValues[index] ??
                              (food.ingredients.isNotEmpty
                                  ? food.ingredients.first.servings
                                  : 100.0);
```

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
In lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart
around lines 118 to 121, avoid hard-coding the default portion size to 100.0
grams as it may reduce accuracy and surprise users. Refactor the logic to
extract the default portion size determination into a shared helper function
that respects the food’s first-ingredient serving size. Then update both
SelectedFoodsTab and NutritionDatabasePage to use this helper, ensuring
consistent and accurate default portion sizes across the app.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-21T14:27:55Z
author_association: NONE
diff_hunk: @@ -83,13 +83,10 @@ class _NutritionDatabasePageState extends State<NutritionDatabasePage>
 
   void _addFoodToSelection(FoodAnalysisResult food) {
     setState(() {
-      _selectedFoods.add(food);
-
-      // Initialize portion value for the new food
+      _selectedFoods.add(
+          food); // Initialize portion value for the new food - always use 100.0 grams
       final index = _selectedFoods.length - 1;
-      final initialPortion =
-          food.ingredients.isNotEmpty ? food.ingredients[0].servings : 100.0;
-      _portionValues[index] = initialPortion;
+      _portionValues[index] = 100.0;
 
path: lib/features/food_database_input/presentation/food_database_page.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**Portion map initialisation aligns with UI but duplicates constant**  

The magic number `100.0` now appears in several widgets.  Extract a `const double kDefaultPortionGrams = 100.0;` in a shared file to keep the value DRY and avoid silent divergence later.

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
In lib/features/food_database_input/presentation/food_database_page.dart around
lines 86 to 90, the hardcoded portion value 100.0 is duplicated across multiple
widgets. To fix this, define a constant double kDefaultPortionGrams = 100.0 in a
shared constants file and replace all occurrences of 100.0 with this constant to
maintain consistency and avoid silent divergence.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-21T14:27:55Z
author_association: NONE
diff_hunk: @@ -118,152 +147,140 @@ class FoodItemCard extends StatelessWidget {
               ],
             ),
 
-            const SizedBox(height: 16),
-
-            // Portion row with count input
+            const SizedBox(height: 16), // Portion and count inputs in a row
             Row(
               children: [
-                Text(
-                  'Portion:',
-                  style: TextStyle(
-                    fontSize: 14,
-                    color: Colors.grey[700],
-                  ),
-                ),
-                const SizedBox(width: 6),
-                Container(
-                  padding:
-                      const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
-                  decoration: BoxDecoration(
-                    color: primaryGreen.withOpacity(0.1),
-                    borderRadius: BorderRadius.circular(4),
-                  ),
-                  child: Text(
-                    '${portion.toStringAsFixed(1)}g',
-                    style: TextStyle(
-                      fontWeight: FontWeight.bold,
-                      color: primaryGreen,
-                    ),
-                  ),
-                ),
-                const Spacer(),
-                Text(
-                  'Count:',
-                  style: TextStyle(
-                    fontSize: 14,
-                    color: Colors.grey[700],
-                  ),
-                ),
-                const SizedBox(width: 6),
-                SizedBox(
-                  width: 50,
-                  height: 32,
-                  child: TextFormField(
-                    controller: countController,
-                    keyboardType: TextInputType.number,
-                    textAlign: TextAlign.center,
-                    decoration: InputDecoration(
-                      contentPadding: const EdgeInsets.symmetric(
-                        vertical: 6,
-                        horizontal: 8,
-                      ),
-                      isDense: true,
-                      border: OutlineInputBorder(
-                        borderRadius: BorderRadius.circular(4),
-                        borderSide: BorderSide(color: primaryGreen),
+                // Count input
+                Expanded(
+                  flex: 1,
+                  child: Column(
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    children: [
+                      Text(
+                        'Count:',
+                        style: TextStyle(
+                          fontSize: 14,
+                          color: Colors.grey[700],
+                        ),
                       ),
-                      focusedBorder: OutlineInputBorder(
-                        borderRadius: BorderRadius.circular(4),
-                        borderSide: BorderSide(color: primaryGreen, width: 2),
+                      const SizedBox(height: 6),
+                      SizedBox(
+                        height: 40,
+                        child: TextFormField(
+                          controller: widget.countController,
+                          keyboardType: TextInputType.number,
+                          textAlign: TextAlign.center,
+                          decoration: InputDecoration(
+                            contentPadding: const EdgeInsets.symmetric(
+                              vertical: 10,
+                              horizontal: 8,
+                            ),
+                            isDense: true,
+                            border: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide:
+                                  BorderSide(color: widget.primaryGreen),
+                            ),
+                            focusedBorder: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide: BorderSide(
+                                  color: widget.primaryGreen, width: 2),
+                            ),
+                            counter: const SizedBox.shrink(),
+                          ),
+                          maxLength: 2,
+                          // No real-time updates - only update when editing is complete
+                          onEditingComplete: () {
+                            FocusScope.of(context).unfocus();
+                            // Calculation will happen when the focus is lost
+                          },
+                          style: const TextStyle(
+                            fontSize: 14,
+                            fontWeight: FontWeight.bold,
+                          ),
+                        ),
                       ),
-                      counter: const SizedBox.shrink(),
-                    ),
-                    maxLength: 2,
-                    style: const TextStyle(
-                      fontSize: 14,
-                      fontWeight: FontWeight.bold,
-                    ),
+                    ],
                   ),
                 ),
-              ],
-            ),
 
-            const SizedBox(
-                height:
-                    12), // Centered slider (improved touch target with fixed center thumb)
-            Container(
-              padding:
-                  const EdgeInsets.symmetric(vertical: 12.0, horizontal: 4.0),
-              margin: const EdgeInsets.symmetric(vertical: 8.0),
-              decoration: BoxDecoration(
-                color: Colors.grey.withOpacity(0.05),
-                borderRadius: BorderRadius.circular(16),
-                border: Border.all(color: Colors.grey.withOpacity(0.1)),
-              ),
-              child: Column(
-                children: [
-                  // Slider usage hint
-                  Padding(
-                    padding: const EdgeInsets.only(bottom: 8.0),
-                    child: Text(
-                      'Hold and Drag slider to adjust portion',
-                      style: TextStyle(
-                        fontSize: 12,
-                        color: Colors.grey[600],
-                        fontStyle: FontStyle.italic,
-                      ),
-                      textAlign: TextAlign.center,
-                    ),
-                  ), // Standard Flutter Slider with enhanced appearance
-                  SliderTheme(
-                    data: const SliderThemeData(
-                      trackHeight: 4.0,
-                      thumbShape: RoundSliderThumbShape(
-                        enabledThumbRadius: 12.0,
-                        pressedElevation: 8.0,
-                      ),
-                      overlayShape: RoundSliderOverlayShape(
-                        overlayRadius: 24.0,
-                      ),
-                      tickMarkShape: RoundSliderTickMarkShape(
-                        tickMarkRadius: 2.0,
+                const SizedBox(width: 16),
+
+                // Portion input
+                Expanded(
+                  flex: 2,
+                  child: Column(
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    children: [
+                      Text(
+                        'Portion (grams):',
+                        style: TextStyle(
+                          fontSize: 14,
+                          color: Colors.grey[700],
+                        ),
                       ),
-                      showValueIndicator: ShowValueIndicator.always,
-                      valueIndicatorShape: PaddleSliderValueIndicatorShape(),
-                      valueIndicatorTextStyle: TextStyle(
-                        color: Colors.white,
-                        fontSize: 14.0,
-                        fontWeight: FontWeight.bold,
+                      const SizedBox(height: 6),
+                      SizedBox(
+                        height: 40,
+                        child: TextFormField(
+                          controller: _portionController,
+                          keyboardType: TextInputType.number,
+                          textAlign: TextAlign.center,
+                          decoration: InputDecoration(
+                            contentPadding: const EdgeInsets.symmetric(
+                              vertical: 10,
+                              horizontal: 8,
+                            ),
+                            isDense: true,
+                            suffixText: 'g',
+                            suffixStyle: TextStyle(
+                              color: widget.primaryGreen,
+                              fontWeight: FontWeight.bold,
+                            ),
+                            border: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide:
+                                  BorderSide(color: widget.primaryGreen),
+                            ),
+                            focusedBorder: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide: BorderSide(
+                                  color: widget.primaryGreen, width: 2),
+                            ),
+                            counter: const SizedBox.shrink(),
+                          ),
+                          maxLength: 4,
+                          // Update only when user is done editing
+                          onEditingComplete: () {
+                            FocusScope.of(context).unfocus();
+                            _updatePortionValue();
+                          },
+                          onFieldSubmitted: (_) {
+                            _updatePortionValue();
+                          },
+                          style: const TextStyle(
+                            fontSize: 14,
+                            fontWeight: FontWeight.bold,
+                          ),
+                        ),
                       ),
-                    ),
-                    child: Slider(
-                      min: 10,
-                      max: 500,
-                      value: portion,
-                      divisions: 49,
-                      activeColor: primaryGreen,
-                      inactiveColor: primaryGreen.withOpacity(0.2),
-                      label: '${portion.toStringAsFixed(0)}g',
-                      onChanged: (value) => onPortionChanged(index, value),
-                    ),
+                    ],
                   ),
+                ),
+              ],
+            ),
 
-                  // Key markers for better understanding of the scale
-                  Padding(
-                    padding: const EdgeInsets.only(
-                        top: 4.0, left: 12.0, right: 12.0),
-                    child: Row(
-                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                      children: [
-                        _buildMarker('10g'),
-                        _buildMarker('100g'),
-                        _buildMarker('250g'),
-                        _buildMarker('400g'),
-                        _buildMarker('500g'),
-                      ],
-                    ),
-                  ),
-                ],
+            // Helper text
+            Padding(
+              padding: const EdgeInsets.only(top: 8.0),
+              child: Text(
+                'Enter portion size (1-1000 grams)',
+                style: TextStyle(
+                  fontSize: 12,
+                  color: Colors.grey[600],
+                  fontStyle: FontStyle.italic,
+                ),
+                textAlign: TextAlign.center,
               ),
path: lib/features/food_database_input/presentation/widgets/food_item_card.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**Helper text should inherit semantic colour**  

The helper text is hard-coded to `Grey600`.  For better dark-mode and theming support use `Theme.of(context).textTheme.bodySmall?.copyWith(color: …)` instead.

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
In lib/features/food_database_input/presentation/widgets/food_item_card.dart
around lines 273 to 284, the helper text color is hard-coded to
Colors.grey[600], which does not adapt to dark mode or theming. Update the
TextStyle to inherit from Theme.of(context).textTheme.bodySmall and use copyWith
to set the color, ensuring the text color respects the current theme and
improves accessibility.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-21T14:27:55Z
author_association: NONE
diff_hunk: @@ -118,152 +147,140 @@
               ],
             ),
 
-            const SizedBox(height: 16),
-
-            // Portion row with count input
+            const SizedBox(height: 16), // Portion and count inputs in a row
             Row(
               children: [
-                Text(
-                  'Portion:',
-                  style: TextStyle(
-                    fontSize: 14,
-                    color: Colors.grey[700],
-                  ),
-                ),
-                const SizedBox(width: 6),
-                Container(
-                  padding:
-                      const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
-                  decoration: BoxDecoration(
-                    color: primaryGreen.withOpacity(0.1),
-                    borderRadius: BorderRadius.circular(4),
-                  ),
-                  child: Text(
-                    '${portion.toStringAsFixed(1)}g',
-                    style: TextStyle(
-                      fontWeight: FontWeight.bold,
-                      color: primaryGreen,
-                    ),
-                  ),
-                ),
-                const Spacer(),
-                Text(
-                  'Count:',
-                  style: TextStyle(
-                    fontSize: 14,
-                    color: Colors.grey[700],
-                  ),
-                ),
-                const SizedBox(width: 6),
-                SizedBox(
-                  width: 50,
-                  height: 32,
-                  child: TextFormField(
-                    controller: countController,
-                    keyboardType: TextInputType.number,
-                    textAlign: TextAlign.center,
-                    decoration: InputDecoration(
-                      contentPadding: const EdgeInsets.symmetric(
-                        vertical: 6,
-                        horizontal: 8,
-                      ),
-                      isDense: true,
-                      border: OutlineInputBorder(
-                        borderRadius: BorderRadius.circular(4),
-                        borderSide: BorderSide(color: primaryGreen),
+                // Count input
+                Expanded(
+                  flex: 1,
+                  child: Column(
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    children: [
+                      Text(
+                        'Count:',
+                        style: TextStyle(
+                          fontSize: 14,
+                          color: Colors.grey[700],
+                        ),
                       ),
-                      focusedBorder: OutlineInputBorder(
-                        borderRadius: BorderRadius.circular(4),
-                        borderSide: BorderSide(color: primaryGreen, width: 2),
+                      const SizedBox(height: 6),
+                      SizedBox(
+                        height: 40,
+                        child: TextFormField(
+                          controller: widget.countController,
+                          keyboardType: TextInputType.number,
+                          textAlign: TextAlign.center,
+                          decoration: InputDecoration(
+                            contentPadding: const EdgeInsets.symmetric(
+                              vertical: 10,
+                              horizontal: 8,
+                            ),
+                            isDense: true,
+                            border: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide:
+                                  BorderSide(color: widget.primaryGreen),
+                            ),
+                            focusedBorder: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide: BorderSide(
+                                  color: widget.primaryGreen, width: 2),
+                            ),
+                            counter: const SizedBox.shrink(),
+                          ),
+                          maxLength: 2,
+                          // No real-time updates - only update when editing is complete
+                          onEditingComplete: () {
+                            FocusScope.of(context).unfocus();
+                            // Calculation will happen when the focus is lost
+                          },
+                          style: const TextStyle(
+                            fontSize: 14,
+                            fontWeight: FontWeight.bold,
+                          ),
+                        ),
                       ),
-                      counter: const SizedBox.shrink(),
-                    ),
-                    maxLength: 2,
-                    style: const TextStyle(
-                      fontSize: 14,
-                      fontWeight: FontWeight.bold,
-                    ),
+                    ],
                   ),
                 ),
-              ],
-            ),
 
-            const SizedBox(
-                height:
-                    12), // Centered slider (improved touch target with fixed center thumb)
-            Container(
-              padding:
-                  const EdgeInsets.symmetric(vertical: 12.0, horizontal: 4.0),
-              margin: const EdgeInsets.symmetric(vertical: 8.0),
-              decoration: BoxDecoration(
-                color: Colors.grey.withOpacity(0.05),
-                borderRadius: BorderRadius.circular(16),
-                border: Border.all(color: Colors.grey.withOpacity(0.1)),
-              ),
-              child: Column(
-                children: [
-                  // Slider usage hint
-                  Padding(
-                    padding: const EdgeInsets.only(bottom: 8.0),
-                    child: Text(
-                      'Hold and Drag slider to adjust portion',
-                      style: TextStyle(
-                        fontSize: 12,
-                        color: Colors.grey[600],
-                        fontStyle: FontStyle.italic,
-                      ),
-                      textAlign: TextAlign.center,
-                    ),
-                  ), // Standard Flutter Slider with enhanced appearance
-                  SliderTheme(
-                    data: const SliderThemeData(
-                      trackHeight: 4.0,
-                      thumbShape: RoundSliderThumbShape(
-                        enabledThumbRadius: 12.0,
-                        pressedElevation: 8.0,
-                      ),
-                      overlayShape: RoundSliderOverlayShape(
-                        overlayRadius: 24.0,
-                      ),
-                      tickMarkShape: RoundSliderTickMarkShape(
-                        tickMarkRadius: 2.0,
+                const SizedBox(width: 16),
+
+                // Portion input
+                Expanded(
+                  flex: 2,
+                  child: Column(
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    children: [
+                      Text(
+                        'Portion (grams):',
+                        style: TextStyle(
+                          fontSize: 14,
+                          color: Colors.grey[700],
+                        ),
                       ),
-                      showValueIndicator: ShowValueIndicator.always,
-                      valueIndicatorShape: PaddleSliderValueIndicatorShape(),
-                      valueIndicatorTextStyle: TextStyle(
-                        color: Colors.white,
-                        fontSize: 14.0,
-                        fontWeight: FontWeight.bold,
+                      const SizedBox(height: 6),
+                      SizedBox(
+                        height: 40,
+                        child: TextFormField(
+                          controller: _portionController,
+                          keyboardType: TextInputType.number,
+                          textAlign: TextAlign.center,
+                          decoration: InputDecoration(
+                            contentPadding: const EdgeInsets.symmetric(
+                              vertical: 10,
+                              horizontal: 8,
+                            ),
+                            isDense: true,
+                            suffixText: 'g',
+                            suffixStyle: TextStyle(
+                              color: widget.primaryGreen,
+                              fontWeight: FontWeight.bold,
+                            ),
+                            border: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide:
+                                  BorderSide(color: widget.primaryGreen),
+                            ),
+                            focusedBorder: OutlineInputBorder(
+                              borderRadius: BorderRadius.circular(8),
+                              borderSide: BorderSide(
+                                  color: widget.primaryGreen, width: 2),
+                            ),
+                            counter: const SizedBox.shrink(),
+                          ),
+                          maxLength: 4,
+                          // Update only when user is done editing
+                          onEditingComplete: () {
+                            FocusScope.of(context).unfocus();
+                            _updatePortionValue();
+                          },
+                          onFieldSubmitted: (_) {
+                            _updatePortionValue();
+                          },
+                          style: const TextStyle(
+                            fontSize: 14,
+                            fontWeight: FontWeight.bold,
+                          ),
+                        ),
                       ),
-                    ),
-                    child: Slider(
-                      min: 10,
-                      max: 500,
-                      value: portion,
-                      divisions: 49,
-                      activeColor: primaryGreen,
-                      inactiveColor: primaryGreen.withOpacity(0.2),
-                      label: '${portion.toStringAsFixed(0)}g',
-                      onChanged: (value) => onPortionChanged(index, value),
-                    ),
+                    ],
                   ),
+                ),
+              ],
+            ),
 
path: lib/features/food_database_input/presentation/widgets/food_item_card.dart
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**InputFormatters would prevent invalid keystrokes**  

Both count and portion fields rely on post-edit validation.  Adding a numeric `FilteringTextInputFormatter.digitsOnly` (and optionally a range-limiting custom formatter) provides immediate feedback and guards against copy-paste of non-numeric text.

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
In lib/features/food_database_input/presentation/widgets/food_item_card.dart
between lines 209 and 272, the TextFormField for portion input currently relies
on post-edit validation without restricting input characters. To fix this, add
the FilteringTextInputFormatter.digitsOnly to the inputFormatters property of
the TextFormField to allow only numeric digits during input. Optionally,
implement a custom input formatter to limit the numeric range if needed. This
change will prevent invalid keystrokes and improve user input experience.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-21T14:27:55Z
author_association: NONE
diff_hunk: @@ -25,18 +25,47 @@
     required this.primaryGreen,
     required this.primaryPink,
   });
-  // Helper method to build marker labels
-  Widget _buildMarker(String text) {
-    return Text(
-      text,
-      style: TextStyle(
-        fontSize: 10,
-        color: Colors.grey[600],
-        fontWeight: text == '10g' || text == '500g'
-            ? FontWeight.bold
-            : FontWeight.normal,
-      ),
-    );
+
+  @override
+  State<FoodItemCard> createState() => _FoodItemCardState();
+}
+
+class _FoodItemCardState extends State<FoodItemCard> {
+  // Controller for the portion input
+  late TextEditingController _portionController;
+
+  @override
+  void initState() {
+    super.initState();
+    _portionController =
+        TextEditingController(text: widget.portion.toStringAsFixed(0));
+  }
+
+  @override
+  void didUpdateWidget(FoodItemCard oldWidget) {
+    super.didUpdateWidget(oldWidget);
+    if (oldWidget.portion != widget.portion) {
+      _portionController.text = widget.portion.toStringAsFixed(0);
+    }
+  }
+
+  @override
+  void dispose() {
+    _portionController.dispose();
+    super.dispose();
+  }
+
+  // Helper method to update the portion value
+  void _updatePortionValue() {
+    if (_portionController.text.isNotEmpty) {
+      int? intValue = int.tryParse(_portionController.text);
+      if (intValue != null && intValue >= 1 && intValue <= 1000) {
+        widget.onPortionChanged(widget.index, intValue.toDouble());
+      } else {
+        // Reset to valid value if entered value is invalid
+        _portionController.text = widget.portion.toStringAsFixed(0);
+      }
+    }
   }
path: lib/features/food_database_input/presentation/widgets/food_item_card.dart
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Decimal portions are no longer accepted**  

`_updatePortionValue` parses the text with `int.tryParse`, silently rejecting any decimal value (e.g. “37.5”).  This is a regression compared with the previous slider which allowed doubles.  

```diff
- int? intValue = int.tryParse(_portionController.text);
- if (intValue != null && intValue >= 1 && intValue <= 1000) {
-   widget.onPortionChanged(widget.index, intValue.toDouble());
+ final num? number = num.tryParse(_portionController.text);
+ if (number != null && number >= 1 && number <= 1000) {
+   widget.onPortionChanged(widget.index, number.toDouble());
```



> Committable suggestion skipped: line range outside the PR's diff.

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
In lib/features/food_database_input/presentation/widgets/food_item_card.dart
around lines 58 to 69, the _updatePortionValue method currently uses
int.tryParse which rejects decimal values, causing regression from previous
behavior that allowed doubles. Update the parsing logic to use double.tryParse
instead, validate that the parsed double is within the allowed range (1 to
1000), and pass the double value to widget.onPortionChanged. Also ensure that
when resetting the text, it formats the double value correctly.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-21T14:27:56Z
author_association: NONE

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-05-21T14:24:49Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough

The updates standardize the initialization of food portion values to always use 100 grams, replacing previous conditional logic. The `FoodItemCard` widget is now stateful, allowing users to edit portion sizes directly via an input field with validation. Additionally, the debug banner in the main app is disabled for a cleaner UI.

## Changes

| File(s)                                                                                  | Change Summary                                                                                                                                                                                                                   |
|------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `lib/features/food_database_input/presentation/food_database_page.dart`<br>`lib/features/food_database_input/presentation/widgets/selected_foods_tab.dart` | Simplified the logic for initializing and retrieving food portion values to always default to 100 grams, removing conditional checks for ingredient data.                                  |
| `lib/features/food_database_input/presentation/widgets/food_item_card.dart`              | Converted `FoodItemCard` from stateless to stateful to manage editable portion input with validation; removed slider; updated UI layout for count and portion inputs; improved input handling and styling.                        |
| `lib/main.dart`                                                                         | Disabled the debug banner in the app by setting `debugShowCheckedModeBanner: false` in the `MaterialApp` widget.                                                                          |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant FoodItemCard (Stateful)
    participant App State

    User->>FoodItemCard (Stateful): Edit portion input
    FoodItemCard (Stateful)->>FoodItemCard (Stateful): Validate input (1-1000g)
    alt Valid input
        FoodItemCard (Stateful)->>App State: Update portion value via callback
    else Invalid input
        FoodItemCard (Stateful)->>FoodItemCard (Stateful): Reset to previous valid value
    end
```

## Poem

> 🍏  
> A hundred grams, the standard now,  
> No sliders left to tweak or plow.  
> Input fields for grams and count,  
> With validation paramount!  
> The debug banner’s gone—hooray!  
> Clean and crisp, the app’s display.  
> 🍎

<!-- walkthrough_end -->

<!-- announcements_start -->

> [!NOTE]
> <details>
> <summary>⚡️ AI Code Reviews for VS Code, Cursor, Windsurf</summary>
> 
> CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
> Learn more [here](http://coderabbit.ai/ide).
> 
> </details>

---

> [!NOTE]
> <details>
> <summary>⚡️ Faster reviews with caching</summary>
> 
> CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure `Review - Disable Cache` at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the `Data Retention` setting under your Organization Settings.
> Enjoy the performance boost—your workflow just got faster.
> 
> </details>

<!-- announcements_end -->

---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: ASSERTIVE**
**Plan: Lite**
**Cache: Disabled due to data retention organization setting**
**Knowledge Base: Disabled due to data retention organization setting**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 029f7ba1eee12ccd1e9ddde5d44589746de14e23 and 1af1ea39b9cc66fa99bf31cd8170a84be8a179ca.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `test/features/food_database_input/presentation/widgets/selected_foods_tab_test.dart` (0 hunks)

</details>

<details>
<summary>💤 Files with no reviewable changes (1)</summary>

* test/features/food_database_input/presentation/widgets/selected_foods_tab_test.dart

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNxU3bABsvkCiQBHbGlcABpIcVwvOkgAIhsAUQAxAEEAYWgAeRsuBlhMUnpufApxfCx4DE9cSDZcWEV+LAAzfEbaahU0RBIUKrxQ2PtsAWZ1Gno5SGwevm5pfC98Hu5wytwKRWwGaXsSKSpfAGsSeWxuDppkXnhmZ3gveVaGGZjyiNhegAMkttoASRozDSzloXwUzGK5AwNUwRRKZSw+QwtC8lSIkAA7uoEFh6r00NxVuglhgMdj6uhapUSugiWiGNR4O8mBhmvAiNgqIjGMjSBo3J9ID8/oCSMDQeCmJDyuwsd0/CRmmgxCUYs1NswqV8AMq4agkaKIRAAdXgtFIuHBBG1eoNz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VfftOgDkwmFDeLV05yiZSoVEkCMkHeSAXQSABQzE2baQLgL4Wqo4EEVdeSpIApREXHZqmwfaKQaFVq7E+S7q/AK2enFA3AJ88oQanEt7KqvOIUJ9VcCSFidBZIhPRK5PPMqEhFSkH08peAP0wErmRkHoMbeamALmT4LwZKB0UAnkOwnKVlACWlFZYnElaYpXQwAwXOTpAOdhYuS4sfFgKOKuNAGuG4+uKYRRKgFuDOdubOH632SOdQKeJMvMI9AWJK2lUoLOb636+iAAJgAE5mgAB2MGKiCiEgKiQm9tWgKm4mhsJQAAVloAABZ2aWa3Ziayb2aAA2JQKidmkgQml2PGpGiAaiJoqmtAF2YmgQYm9tfm/m5UYmhW5oF2KiBgWgN2KiMm+iNAN2dmz0N2NAfWpWlcDuX66UMYXANGy3TGwWPMf2PGoAA=== -->

<!-- internal state end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Pemuda-Pembuka-Langkah/pockeat-mobile&utm_content=383):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: NONE
user: login: codecov[bot]
created_at: 2025-05-21T14:32:19Z
body: ### :x: 2 Tests Failed:
| Tests completed | Failed | Passed | Skipped |
|---|---|---|---|
| 2476 | 2 | 2474 | 0 |
<details><summary>View the top 2 failed test(s) by shortest run time</summary>

> <pre><code class="language-python">.home.runner.work.pockeat_mobile.pockeat_mobile.test.features.food_database_input.presentation.widgets.selected_foods_tab::SelectedFoodsTab should call onAdjustPortion when slider value changes</code></pre>
> <details><summary>Stack Traces | 0.229s run time</summary>
> 
> > <pre><code class="language-python">Error:
> > 
> > Test failed. See exception logs above.
> > The test description was: should call onAdjustPortion when slider value changes</code></pre>
> 
> </details>


> <pre><code class="language-python">.home.runner.work.pockeat_mobile.pockeat_mobile.test.features.food_database_input.presentation.widgets.selected_foods_tab::SelectedFoodsTab should have portion adjustment sliders</code></pre>
> <details><summary>Stack Traces | 0.375s run time</summary>
> 
> > <pre><code class="language-python">Error:
> > 
> > Test failed. See exception logs above.
> > The test description was: should have portion adjustment sliders</code></pre>
> 
> </details>

</details>

To view more test analytics, go to the [Test Analytics Dashboard](https://app.codecov.io/gh/Pemuda-Pembuka-Langkah/pockeat-mobile/tests/PBI-implementFreeTrialLimit)
<sub>📋 Got 3 mins? [Take this short survey](https://forms.gle/BpocVj23nhr2Y45G7) to help us improve Test Analytics.</sub>
author_association: NONE