MacroMath UI
Components · App

Photo Food Picker

Bottom-sheet to take/pick a photo and analyze it with AI (Premium).

App · Flutter · macromath_mobile

A reusable bottom-sheet to take or pick a photo and analyze it with the AiService. It shows the source (camera/gallery), an analysis state with a thumbnail, and returns a structured result. Because it uses AI, it is a Premium feature — the picker calls the paywall automatically when needed.

Modes

ModeUseReturns
foodMealFoods with macros (name, quantity, unit, calories, protein, carbs, fat).
pantryPantrySimple items (name, quantity, unit, category, brand).
shoppingShopping listSimple items.

Parameters

ParameterTypeDefaultDescription
modePhotoAnalysisModefood, pantry or shopping.
hintString?nullOptional hint for the AI.

Result — PhotoAnalysisResult

FieldTypeDescription
modePhotoAnalysisModeMode used in the analysis.
itemsList<Map<String, dynamic>>Detected items.
confidencedoubleConfidence (0–1).
summaryStringText summary of the analysis.
isEmptybooltrue if there were no detections.

Usage

import 'package:macromath_mobile/presentation/widgets/photo_food_picker.dart';

final result = await showPhotoFoodPicker(
  context,
  mode: PhotoAnalysisMode.food,
);

if (result != null && !result.isEmpty) {
  // add result.items to the meal
}

Returns null if the user cancels or if they don't have Premium (the paywall is shown in that case).

On this page