π° Almond β Documentation & Setup Guide
Whether you're evaluating the app, planning a rebrand, or setting up the code, this guide balances visual, plain-language explanations with technical setup details. Start with App Overview if you're new β jump to Getting Started when you're ready to build.
Beginner's Guide β No Coding Required to Start
Simple, visual, step-by-step instructions for buyers who have never opened a code editor. Technical details are optional β follow the pictures.
What you need
A Windows, Mac, or Linux computer, an internet connection, and about 1β2 hours for first-time setup. You do not need to understand programming β just follow each step in order.
Try the app instantly (no setup)
Open the demo/ folder in the download package. Install app-release.apk on any Android phone to test the full app β onboarding, diary, recipes, and meal plans β without building anything.
Unzip the project folder
Extract almond-source.zip to a simple location like Documents/Almond. You should see folders named lib, assets, android, and files named index.html and pubspec.yaml.
π assets/ β images & icons
π lib/ β app screens
π android/ β Android build files
π screenshots/ β all app screenshots
π index.html β open this documentation
π pubspec.yaml
Install Flutter (one-time)
Go to docs.flutter.dev/get-started/install and download Flutter for your operating system. Run the installer, then open Terminal (Mac) or Command Prompt (Windows) and type flutter doctor. Fix any items marked with a red β by following the on-screen links.
Install Android Studio (for Android builds)
Download Android Studio from Google. During setup, accept the Android SDK license when prompted. This gives you a phone emulator so you can test the app on your computer without a physical device.
Open the project & run the app
Open Android Studio β File β Open β select the unzipped Almond folder. Wait for indexing to finish, then open the built-in terminal at the bottom and type:
flutter pub get
flutter run
Select an emulator or connected phone when prompted. The app will build and launch β first build may take 5β10 minutes.
Rebrand the app (change name & colors)
You don't need to touch code for a basic rebrand. Follow the visual Branding Guide β it shows exactly which files to replace for your logo, app name, and colors, with before/after pictures.
Need more detail?
See Visual Setup Guide for folder diagrams, or Environment Setup for Firebase and API keys.
App Overview β What Almond Does
A visual tour of every primary screen. Written for non-technical buyers β technical file paths are optional notes at the bottom of each card.
In one sentence
Almond is an all-in-one health companion: users set personal goals, log meals and water, track weight and activity, browse meal plans and recipes, and review nutrition trends β all from a single diary-style home screen.
Four main areas users see every day
Diary β daily home base
Calendar at the top, nutrition ring, meal slots (breakfast β dinner), water, weight, and activity β all for the selected day.
Meal Plans β structured programs
Ready-made plans (weight loss, muscle gain, vegetarian, etc.) with weekly schedules and shopping lists.
Recipes β browse & cook
Searchable recipe catalog with photos, ingredients, steps, and one-tap βadd to mealβ logging.
Profile β settings & goals
Language, dark/light theme, notifications, nutrition targets, and weight goal management.
Screenshot gallery β all primary screens (20 screens)
Every core screen is shown below. High-resolution PNGs are in the screenshots/ folder (01β20) inside the download package.
lib/screens/. The diary hub is diary_screen.dart; bottom tabs are in main_navigation_screen.dart.
UI/UX FAQ β Common Questions
Quick answers to help buyers understand how the app works from an end-user perspective β before diving into code.
What does the user see when they open the app for the first time?
How do users log what they eat?
- Search β type a food name from the built-in database
- Barcode scan β point the camera at a product label
- AI photo recognition β snap a photo of the plate (requires OpenAI API key; marked as Pro)
What is the Diary tab and why is it the home screen?
How do Meal Plans differ from Recipes?
Can users switch between dark and light mode?
Does the app support multiple languages?
assets/lang/ for easy extension.
What are Premium / Pro features?
How does water tracking work?
How does weight tracking work?
Is there a demo I can try without building the app?
demo/app-release.apk.
Install it on any Android device to experience onboarding, diary logging, meal plans, and recipes immediately.
What do I need beyond the purchase to run AI features?
Ready to customize or build?
Continue to the Branding Guide to rebrand colors and logo, Getting Started for setup steps, or Navigation Flow for technical architecture diagrams.
Navigation Flow & Data Architecture
Understand how screens interact, transition, and connect with underlying controllers and persistence layers.
Application Screen Hierarchies
Dynamic rendering of transitions from startup to tab views and detail drawers.
graph TD
A[Splash Screen] -->|Checks Questionnaire Completed| B[User Questionnaire]
B -->|Persists Goals & Recalculates Targets| C[Main Navigation Screen]
A -->|If Already Completed| C
C -->|Tab 1| D[Diary Dashboard]
C -->|Tab 2| E[Meal Plans List]
C -->|Tab 3| F[Recipes Browser]
C -->|Tab 4| G[Profile Settings]
D -->|SelectedDateProvider syncs sub-widgets| H[Nutrition Panel]
D -->|Meals Log sub-widget| I[Meals Screens Feed]
D -->|Fluid logger sub-widget| J[Water Tracker Screen]
D -->|Weight entries sub-widget| K[Weight Tracker Screen]
D -->|Physical logs sub-widget| L[Activity Tracker Screen]
E -->|Select Template| M[Meal Plan Detail Screen]
M -->|Persist Active Plan in SQLite| C
M -->|Extracts Ingredients| N[Grocery / Shopping List Screen]
F -->|Select Recipe Card| O[Recipe Details Screen]
O -->|Modifies Portions Dynamically| O
O -->|Pushes Ingredients| N
subgraph Firebase["Cloud Firestore"]
FB1[(recipes)]
FB2[(foods)]
FB3[(meal_plans)]
end
F -->|RecipeService| FB1
I -->|FoodService| FB2
E -->|MealPlanService sync| FB3
FB3 -->|Cache catalog + meals| E
K -->|Click 'Manage Goals'| P[Goal Management Screen]
P -->|Recalculates Basal Metabolic Rate| H
SelectedDateProvider. Detail screens (recipe, meal plan, food search) push on top of tabs and return without losing tab state.
Bottom Tab Navigation Map
Annotated map of the four persistent tabs in main_navigation_screen.dart.
flowchart LR
subgraph Tabs["Main Navigation β 4 Tabs"]
T1["π Diary
diary_screen.dart"]
T2["π Meal Plan
meal_plan_screen.dart"]
T3["π½ Recipes
recipes_screen.dart"]
T4["π€ Profile
profile_settings_screen.dart"]
end
T1 --> D1["Nutrition panel"]
T1 --> D2["Meals feed"]
T1 --> D3["Water tracker"]
T1 --> D4["Weight tracker"]
T1 --> D5["Activity tracker"]
T2 --> M1["Meal plan detail"]
M1 --> M2["Shopping list"]
T3 --> R1["Recipe detail"]
R1 --> R2["Shopping list"]
T4 --> P1["Nutrition goals"]
T4 --> P2["Goal management"]
Food Logging User Flow
How buyers reach meal logging from the Diary hub.
flowchart TD
A[Diary β Meals panel] --> B{Add food method}
B -->|Search| C[Food Search Screen]
B -->|Barcode| D[Scan Barcode Screen]
B -->|Camera| E[AI Photo Recognition]
C --> F[Meal Details Screen]
D --> F
E --> G[Food Recognition Details]
G --> F
F --> H[(SQLite meal log)]
H --> I[Nutrition totals update on Diary]
GetX Routing & DI Registration
Navigation is mapped using named routes declared in lib/config/routes/app_routes.dart.
Dependency Injection (DI) is handled on app startup via lib/config/bindings/initial_binding.dart,
which lazily registers controllers globally to avoid boilerplate loading inside individual view sheets.
User Journey & Onboarding Flow
Step-by-step annotated flowcharts showing what first-time and returning users experience β from splash to daily tracking.
First Launch vs Returning User
Routing logic in splash_screen.dart and OnboardingMiddleware (app_routes.dart).
flowchart TD
Start([App Launch]) --> Splash[Splash Screen]
Splash --> Check{Questionnaire
completed?}
Check -->|No β first time| Q[7-Step Onboarding Wizard]
Check -->|Yes β returning| Home[Main Navigation / Diary]
Q --> QDone[Save goals to SQLite
isQuestionnaireFinished = true]
QDone --> Home
Home --> Daily[Daily tracking loop:
log meals, water, weight, activity]
localStorage under isQuestionnaireFinished. Returning users skip directly to the Diary tab. To test onboarding again during development, clear app data or remove this key.
Onboarding Wizard β 7 Steps
Sequence inside user_questionnaire_screen.dart. Each step collects data used for BMR and macro targets.
flowchart LR
S1["1. Goal type
lose / build / maintain / health"]
S2["2. Gender"]
S3["3. Activity level"]
S4["4. Current weight"]
S5["5. Target weight"]
S6["6. Height"]
S7["7. Age β Finish"]
S1 --> S2 --> S3 --> S4 --> S5 --> S6 --> S7
S7 --> Calc["Mifflin-St Jeor BMR
+ activity multiplier"]
Calc --> Save["Persist to SQLite
+ nutrition goals"]
Annotated screenshot β navigation map
The Diary screen is the home base. Numbered pins show where users navigate from here.
Header stats
Nutrition ring
Meals panel
β Diary
β‘ Meal Plan
β’ Recipes
β£ Profile
Annotated journey timeline
Splash & route decision
App initializes Firebase, SQLite, notifications, and locale. Splash checks whether onboarding was completed, then routes to /questionnaire or /home.
Onboarding questionnaire (first launch only)
Seven animated steps collect goal, demographics, and measurements. On finish, daily calorie and macro targets are calculated and saved locally.
Diary dashboard β daily hub
User lands on the Diary tab. The week calendar drives all sub-panels (nutrition ring, meals, water, weight, activity) for the selected date.
Log food & track progress
From Diary β Meals, users search foods, scan barcodes, or use AI photo recognition. Water, weight, and activity can be logged from their respective panels.
Meal plans & recipes
Meal Plan and Recipes tabs browse Firebase catalogs. Selecting a plan or recipe opens a detail screen; ingredients can be pushed to the shopping list.
Profile & goals
Profile tab manages language, theme, notifications, nutrition goals, and weight goal management. Changes can trigger macro recalculation prompts.
Application Modules
Direct links and overviews of the core components asked to deconstruct.
User Onboarding Questionnaire
user_questionnaire_screen.dartHandles user demographic information gathering, weight goal setting, and computes initial caloric/macronutrient values on first setup.
Explore Details →Diary Dashboard Hub
diary_screen.dartThe primary landing dashboard displaying aggregate statistics (consumed calories, weight logs, active minutes) synchronized by date.
Explore Details →Meal Plan Details
meal_plan_detail_screen.dartRenders detailed week-by-week calendar of recipes for weight loss, keto, or muscle building templates with lock/unlock filters.
Explore Details →Recipe Details & Walkthrough
recipe_details_screen.dartInteractive ingredients viewer with dynamic servings modifier, cooking directions tabs, and advanced macro charts.
Explore Details →Goal Settings Management
goal_management_screen.dartWeight goals manager that monitors unit conversions (kg & lbs) and recalculates macro requirements upon target variations.
Explore Details →Firestore Data Layer
lib/core/firebase/Recipes, foods, and meal plan catalogs are loaded from Cloud Firestore. Seeders populate collections from mock/seed data on first launch.
Explore Firebase →Mock & Seed Sources
lib/helpar/mock/ & lib/core/firebase/Static recipe mock data and food/meal-plan seed files used to populate Firestore when collections are empty.
Explore Firebase →Legacy Mock Services
lib/helpar/mock/recipes-mock-data.dart
MockRecipeService remains in the mock file for reference and Firestore seeding. Runtime recipe/food flows use Firebase services.
Deep-Dive Module Deconstruction
Click tabs to view the file analysis, code outlines, and architectural rules for each section.
Onboarding Questionnaire Flow
The UserQuestionnaire screen maps a 8-step wizard form to register new users' parameters.
Rather than generic text forms, it builds horizontal/vertical scroll dials using custom sliders.
-
State Flow: Stores progress in a local memory Map
userAnswers(age, weight, height, goal, gender, activityLevel) and moves through pages via an animatedPageViewwrapper. -
BMR Nutritional Equation: On complete, calculates target calories using the Mifflin-St Jeor formula:
Male: BMR = (10 × wt_kg) + (6.25 × ht_cm) - (5 × age) + 5Female: BMR = (10 × wt_kg) + (6.25 × ht_cm) - (5 × age) - 161 -
Activity Multipliers: BMR is scaled according to activity:
β’ Sedentary: 1.2 | Lightly Active: 1.375 | Moderately Active: 1.55 | Very Active: 1.725 -
SQLite & Storage Sync: Saves goals in the local SQLite table via
WeightTrackerController.addWeightGoal()and flags setup completion inGetStorageso splash directs them directly to dashboard on next boot.
// user_questionnaire_screen.dart Outline
class UserQuestionnaire extends StatefulWidget { ... }
class _UserQuestionnaireState extends State<UserQuestionnaire> {
Map<String, dynamic> userAnswers = {
'goal': '',
'currentWeight': 0.0,
'targetWeight': 0.0,
'height': 0.0,
'age': 0,
'gender': 'male',
};
List<QuestionnaireStep> steps; // 8 configuration wizard steps
PageController _pageController;
int _currentPage = 0;
void _finishQuestionnaire() async {
// 1. Compute Mifflin-St Jeor BMR base
// 2. Scale by selected activity multiplier
// 3. Save WeightGoal into Database via SQLite
// 4. Save initial NutritionGoals
// 5. Route to named Main Navigation screen
}
}
Diary Dashboard Architecture
The DiaryScreen acts as the central dashboard hub for the user. It aggregates sub-widgets mapping food calories, fluid tracker levels, weight metrics, and active minutes.
-
Date-Driven Binding: Rather than passing parameters down nested trees, the date is managed globally via
SelectedDateProvider. Sub-widget controllers listen to date changes and dynamically reload SQLite tables. -
Staggered Loading UI: Employs three distinct
AnimationControllerinstances (header, calendar, content components) executing slide/fade transitions on start to create a premium feel. -
Developer Debugging: Features a cleanup button in the header that invokes
DatabaseHelper.clearAllTables()and erasesGetStoragepreferences for reset testing.
// diary_screen.dart Outline
class DiaryScreen extends StatefulWidget { ... }
class _DiaryScreenState extends State<DiaryScreen> {
// Sync State Controllers
WaterTrackerController waterController;
WeightTrackerController weightController;
MealsController mealsController;
DateTime _selectedDay = DateTime.now();
// 3-way staggered animations
AnimationController _headerAnimationController;
AnimationController _calendarAnimationController;
AnimationController _contentAnimationController;
// Assembles subcomponents inside body list
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
_buildCustomAppBar(), // Display Quick stat indicators
_buildCalendarStrip(), // TableCalendar week view
_buildDashboardItems(), // Nutrition, Water, Weight panel views
]
)
);
}
}
Meal Plan Calendar & Active Schedules
The MealPlanDetailScreen reads meals from local SQLite (synced from Firestore). Catalog metadata and recipeIds come from the meal_plans collection; progress and active-plan state stay on-device.
-
Firestore catalog:
MealPlanServicefetches plans from collectionmeal_plans.MealPlanController.refreshMealPlans()upserts catalog rows and re-syncs meals whenrecipeIdschange in Firebase. - Paywall Validation: Reads local variables to toggle premium intro sliders. If user is locked, details are hidden behind a premium banner.
-
SQLite Database Mapping: Completes items by persisting changes inside database:
β’ CallsDatabaseHelper.updateMealCompletion(rowId, status).
β’ Reflects completion states by rendering check indicators inside the Day Strip list. -
Grocery Accumulator: Aggregates all ingredients matching the plan's duration and routes to
MealPlanShoppingListScreen.
// meal_plan_detail_screen.dart Outline
class MealPlanDetailScreen extends StatefulWidget { ... }
class _MealPlanDetailScreenState extends State<MealPlanDetailScreen> {
int selectedWeek = 1;
int selectedDay = 1;
Set<String> _checkedMeals = {}; // Track checked items
Future<void> _loadMealsForWeekMeals() async {
final dbHelper = DatabaseHelper();
// Fetch plan configurations matching week index
final all = await dbHelper.getMealsForPlan(mealPlanId: widget.plan.id);
}
void _toggleMealCompletion(Map meal, String uniqueId, bool isChecked) async {
final dbHelper = DatabaseHelper();
await dbHelper.updateMealCompletion(meal['row_id'], isChecked ? 1 : 0);
// Update calendar markers
}
}
Recipes Details & Servings Multiplier
The RecipeDetailsScreen displays recipe directions, equipment needs, and scaling requirements using a TabBar layout.
-
Sliver Animation Layout: Embeds header images in a
NestedScrollViewwith customSliverAppBarheaders that collapse into narrow navigation titles during scroll gestures. -
Dynamic Serving Multiplier: Offers interactive buttons (+/-) to scale ingredient servings. Modifying serving count updates ingredient fractions dynamically:
β’Display Amount = Base Amount × (New Servings / Base Servings) -
Overview Analytics: Pulls macro variables from
recipeNutritionsarray to build visual charts.
// recipe_details_screen.dart Outline
class RecipeDetailsScreen extends StatefulWidget { ... }
class _RecipeDetailsScreenState extends State<RecipeDetailsScreen> {
int servings = 2;
int originalServings = 2;
List<RecipeIngredient> originalIngredients;
// Servings modification formula
double getScaledAmount(double baseAmount) {
return baseAmount * (servings / originalServings);
}
Widget _buildIngredientsTab(FullRecipe recipe) {
// Loops through list and prints scaled values
// Double tap scales list, routes shopping ingredients list
}
}
Weight Target & Recalculate Trigger
The GoalManagementScreen handles user weight goals configuration, managing unit toggles (lbs/kg) and triggering calorie recalculations.
-
Unit Scaling Conversion: Uses
MeasurementUnitServiceto run calculations:
β’ Lbs to Kg:kg = lbs / 2.20462
β’ Kg to Lbs:lbs = kg × 2.20462 - Goal Recalculate Trigger: Compares updated weight entries against original goals. If changes to current/target weight or activity levels exceed 0.1, a prompt asks the user if they'd like to recalculate daily nutritional targets.
// goal_management_screen.dart Outline
class GoalManagementScreen extends StatefulWidget { ... }
class _GoalManagementScreenState extends State<GoalManagementScreen> {
TextEditingController currentWeightController;
TextEditingController targetWeightController;
GoalTypeEnum selectedGoalType;
String selectedActivityLevel;
// Validates change state
bool _hasActualGoalChanges() {
// Compare against stored _originalCurrentWeight, _originalTargetWeight
// Returns true if delta > 0.1
}
Future<void> _recalculateNutritionGoals() async {
// Re-trigger Mifflin-St Jeor formula
// Save new goals inside NutritionController
}
}
Firebase Architecture & Environment Variables
Almond uses Cloud Firestore as the remote source of truth for recipes, foods, and meal plan catalogs.
FirebaseInitializer runs at app startup (main.dart) when USE_FIREBASE=true.
Firestore Collections
-
recipesβ Full recipe documents (summary fields + ingredients, directions, nutrition). Read byRecipeServiceviaRecipeControllerandrecipes_screen.dart. -
foodsβ Food search items with nestedservingsarrays. Read byFoodServiceviaFoodControllerandfood_search_screen.dart. -
meal_plansβ Plan metadata plusrecipeIdsandmacroProfile. Synced to SQLite byMealPlanControllerformeal_plan_screen.dartandmeal_plan_detail_screen.dart.
Seeders (first launch only)
When a collection is empty, seeders upload default data if the matching .env flag is true:
RecipeFirestoreSeederβlib/helpar/mock/recipes-mock-data.dart(24 recipes)FoodFirestoreSeederβlib/core/firebase/food_seed_data.dart(10 foods)MealPlanFirestoreSeederβlib/core/firebase/meal_plan_seed_data.dart(3 plans)
.env Files
Environment files are loaded by flutter_dotenv in main.dart. Debug builds use .env.debug; release builds use .env.release.
USE_FIREBASE=trueβ Enables Firebase initialization and Firestore services.SEED_FIREBASE_RECIPES=trueβ Seedsrecipesif empty.SEED_FIREBASE_FOODS=trueβ Seedsfoodsif empty.SEED_FIREBASE_MEAL_PLANS=trueβ Seedsmeal_plansif empty.- AI food recognition β routed through Firebase Cloud Function
recognizeFoodImage; OpenAI key stored server-side only (see Publisher Setup).
Tip: Set all SEED_FIREBASE_* flags to false after the first successful seed to avoid unnecessary startup work.
# .env.debug β loaded in debug builds
USE_FIREBASE=true
SEED_FIREBASE_RECIPES=true
SEED_FIREBASE_FOODS=true
SEED_FIREBASE_MEAL_PLANS=true
# .env.release β seed flags usually false in production
USE_FIREBASE=true
SEED_FIREBASE_RECIPES=false
SEED_FIREBASE_FOODS=false
SEED_FIREBASE_MEAL_PLANS=false
// Recipes
recipes_screen β RecipeController β RecipeService β Firestore recipes
// Foods
food_search_screen β FoodController β FoodService β Firestore foods
// Meal plans (hybrid)
meal_plan_screen β MealPlanController
β MealPlanService β Firestore meal_plans
β DatabaseHelper (SQLite cache + is_active, is_completed)
// Startup (main.dart)
FirebaseInitializer.initialize()
β Firebase.initializeApp()
β RecipeFirestoreSeeder.seedIfEmpty() // if SEED_FIREBASE_RECIPES
β FoodFirestoreSeeder.seedIfEmpty() // if SEED_FIREBASE_FOODS
β MealPlanFirestoreSeeder.seedIfEmpty() // if SEED_FIREBASE_MEAL_PLANS
{
"id": 4,
"name": "My Custom Plan",
"image": "assets/summerShred.jpeg",
"weeks": 4,
"category": "Weight Loss",
"recipeIds": [163564, 10001],
"macroProfile": "summerShred"
}
Seed Data & Mock Sources
Mock and seed files supply initial Firestore content. At runtime, the app reads from Firestore servicesβnot from mock services directly (except meal plan SQLite cache for user progress).
-
Recipes:
lib/helpar/mock/recipes-mock-data.dartdefinesmockRecipeSearch,fullRecipeMockData, andMockRecipeService. Used byRecipeFirestoreSeeder. -
Foods:
lib/core/firebase/food_seed_data.dartholdsFoodSeedData.commonFoodsand full serving details for 10 foods. -
Meal plans:
lib/core/firebase/meal_plan_seed_data.dartdefines 3 default plans withrecipeIdsandmacroProfile. - Re-seeding: Seeders only run when the target collection has zero documents. Delete the collection in Firebase Console to force a re-seed.
// Firebase services (runtime)
lib/screens/main/recipes/services/recipe_service.dart
lib/screens/main/meals/services/food_service.dart
lib/screens/main/meal_plan/services/meal_plan_service.dart
// Seeders (startup, if .env flag true)
lib/core/firebase/recipe_firestore_seeder.dart
lib/core/firebase/food_firestore_seeder.dart
lib/core/firebase/meal_plan_firestore_seeder.dart
// Seed / mock data sources
lib/helpar/mock/recipes-mock-data.dart
lib/core/firebase/food_seed_data.dart
lib/core/firebase/meal_plan_seed_data.dart
// Environment
lib/helpar/environment/environment.dart
.env.debug / .env.release
Firebase Setup Guide
Configure Cloud Firestore, native platform files, and environment variables for recipes, foods, and meal plans.
Create Firebase Project
Create a project at Firebase Console. Enable Cloud Firestore (test mode for development). Choose a European region if users are in Morocco/EU.
Add Platform Config
Register Android (com.almond.userapp) and iOS apps. Place google-services.json in android/app/ and GoogleService-Info.plist in ios/Runner/. Or run flutterfire configure.
Configure .env
Set USE_FIREBASE=true and seed flags in .env.debug. Hot restart the app (not hot reload) after changing env values.
Verify Collections
After first launch, confirm recipes, foods, and meal_plans appear in Firestore. Turn seed flags off in .env.release for production.
Connect your own Firebase project
The package ships placeholder config in lib/firebase_options.dart,
android/app/google-services.json, and ios/Runner/GoogleService-Info.plist.
Run flutterfire configure to replace them with your project credentials before publishing.
Firestore Security Rules β seed then lock
The app seeds catalog data from the client when collections are empty (SEED_FIREBASE_* flags).
Never leave Firestore in test mode (public read/write) in production β anyone could modify or delete your catalog.
Recommended workflow:
- Temporarily deploy
firestore.rules.seed(open rules) β copy it overfirestore.rulesand runfirebase deploy --only firestore:rules - Launch the app once with
SEED_FIREBASE_*=trueto populaterecipes,foods, andmeal_plans - Deploy production rules from
firestore.rules(read-only catalog, no client writes) - Set all
SEED_FIREBASE_*flags tofalsein.env.release
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /recipes/{document=**} { allow read: if true; allow write: if false; }
match /foods/{document=**} { allow read: if true; allow write: if false; }
match /meal_plans/{document=**} { allow read: if true; allow write: if false; }
match /{document=**} { allow read, write: if false; }
}
}
Both rule files ship in the project root. Deploy with: firebase deploy --only firestore:rules
Meal plan sync notes
Meal plans use a hybrid model: catalog and recipeIds sync from Firestore; is_active, meal completion, and shopping lists stay in SQLite.
Pull-to-refresh on the meal plans screen re-fetches Firebase. Each plan document needs a numeric id field matching its document ID.
Local Development Setup
Follow these steps to run the Almond app on your local machine. Visual folder guides are included for first-time developers.
Visual setup walkthrough
In Android Studio or VS Code: File β Open β select the unzipped Almond folder (the one containing pubspec.yaml).
π pubspec.yaml β you are here
π lib/
π assets/
π android/
Copy the debug template to create your active config file:
USE_FIREBASE=true
SEED_FIREBASE_RECIPES=true
From Firebase Console, download and place:
GoogleService-Info.plist β ios/Runner/
Open the terminal inside your IDE (bottom panel) and run these commands one at a time:
$ cd ios && pod install && cd ..
$ flutter run
Select a device/emulator when prompted. See screenshot below for expected first screen.
Command reference
Environment & Firebase Tips
Changes to .env.debug or .env.release require a full app restart.
Seeders only populate empty Firestore collectionsβdelete documents in the console to re-seed.
Set SEED_FIREBASE_*=false after initial data upload.
Getting Started (Non-Technical Guide)
A plain-language walkthrough for buyers who are new to Flutter. No advanced coding knowledge required for initial setup.
Install Flutter
Download and install the Flutter SDK from the official site. Follow the install guide for your operating system (Windows, macOS, or Linux).
Install Android Studio or Xcode
Android: Install Android Studio and accept SDK licenses.
iOS (Mac only): Install Xcode from the App Store and open it once to accept terms.
Unzip & Open the Project
Extract the downloaded ZIP to a folder on your computer. Open that folder in Android Studio, VS Code, or Cursor using File β Open.
Configure Environment (.env)
The project ships with .env.debug and .env.release templates. Set at minimum:
Create Your Firebase Project
- Go to Firebase Console and click Create a project.
- Enable Cloud Firestore (start in test mode for development).
- Add an Android app β package name:
com.almond.userappβ downloadgoogle-services.jsonintoandroid/app/. - Add an iOS app β download
GoogleService-Info.plistintoios/Runner/. - Alternatively, run
flutterfire configurefrom the project root to automate this step. - Launch the app once β seed data will populate empty Firestore collections if seed flags are
true.
External Service Costs
OpenAI food recognition requires a paid OpenAI API account β usage is billed per request by OpenAI, not included in this purchase. Firebase offers a free tier, but costs may apply as your user base and database reads/writes grow. Barcode scanning uses the free Open Food Facts API and needs no API key.
Project Environment Setup
Configure .env files before your first run. All paths below are relative to your unzipped project root β no machine-specific locations.
Two environment files
.env.debug β loaded when running debug builds (flutter run).
.env.release β loaded when building release APK/IPA. Set seed flags to false for production.
Step-by-step
- Unzip the package and open the project folder in your IDE.
- Open
.env.debugin the project root. - Set
USE_FIREBASE=trueafter you have created your Firebase project. - Deploy the
recognizeFoodImageCloud Function and set theOPENAI_API_KEYsecret if you need AI food photo recognition (see Publisher Setup). - Leave
SEED_FIREBASE_*=truefor the first launch only, then set them tofalse. - Save the file and run a full app restart β hot reload will not pick up .env changes.
Environment variables reference
| Variable | Required | Description |
|---|---|---|
USE_FIREBASE |
Yes | Set to true to enable Firebase and Firestore. Set false only for offline experiments. |
SEED_FIREBASE_RECIPES |
First launch | Seeds the recipes collection if empty (24 recipes). Set false after first successful seed. |
SEED_FIREBASE_FOODS |
First launch | Seeds the foods collection if empty (10 foods). |
SEED_FIREBASE_MEAL_PLANS |
First launch | Seeds the meal_plans collection if empty (3 plans). |
USE_FIREBASE=true
SEED_FIREBASE_RECIPES=true
SEED_FIREBASE_FOODS=true
SEED_FIREBASE_MEAL_PLANS=true
USE_FIREBASE=true
SEED_FIREBASE_RECIPES=false
SEED_FIREBASE_FOODS=false
SEED_FIREBASE_MEAL_PLANS=false
External service costs
OpenAI β AI food recognition requires your own paid API account. Costs are not included in this item purchase.
Firebase β Google offers a free tier; charges may apply as reads/writes and storage grow with your user base.
Barcode scanning β uses the free Open Food Facts API; no key required.
Publisher Setup β Configure & Ship
End-to-end steps buyers need before publishing: OpenAI for AI food recognition, Firebase placeholders, bundle ID / package name, and Android release signing.
1. OpenAI API key β server-side only (Cloud Function)
AI food photo recognition calls OpenAI through a Firebase Cloud Function (recognizeFoodImage).
The OpenAI key is stored as a Firebase secret and never ships inside the app binary.
Create an OpenAI account
Sign up at platform.openai.com and add a payment method. AI food recognition is billed per API request β not included in this purchase.
Generate an API key
OpenAI Dashboard β API keys β Create new secret key. Copy the key (starts with sk-).
Deploy the Cloud Function
From the project root, install Firebase CLI, link your project, and deploy:
npm install -g firebase-tools
firebase login
firebase use YOUR_PROJECT_ID
firebase functions:secrets:set OPENAI_API_KEY
cd functions && npm install && cd ..
firebase deploy --only functions
The Flutter app calls recognizeFoodImage via cloud_functions in food_image_recognition_service.dart. See functions/README.md for details.
2. Firebase β use your own project (placeholders included)
The package ships with placeholder values in lib/firebase_options.dart, android/app/google-services.json, and ios/Runner/GoogleService-Info.plist. Replace them with your project:
- Install FlutterFire CLI:
dart pub global activate flutterfire_cli - From project root run:
flutterfire configure - Select or create your Firebase project and register Android (
com.almond.userappor your custom ID) and iOS apps - This overwrites the three config files with your real keys automatically
- Set
USE_FIREBASE=truein.envand do a full app restart - Deploy Firestore security rules β see Firebase Setup for seed-then-lock workflow
- Deploy Cloud Functions for AI food recognition β see step 1 above
3. Change bundle ID / package name (Android + iOS)
Default ID on both platforms: com.almond.userapp. Change to your own reverse-domain ID (e.g. com.yourbrand.calorieapp) before registering Firebase apps or store listings.
applicationId and namespacepackage line (move folder to match)PRODUCT_BUNDLE_IDENTIFIER (or Xcode β Signing & Capabilities)$(PRODUCT_BUNDLE_IDENTIFIER) automaticallyflutterfire configure after changing IDs4. Android release signing (Google Play)
Release builds need a signing keystore. An example config is at android/key.properties.example.
keytool -genkey -v -keystore upload-keystore.jks \
-keyalg RSA -keysize 2048 -validity 10000 -alias upload
Store upload-keystore.jks in android/. Never commit the keystore or passwords to git.
Copy the example file:
cp android/key.properties.example android/key.properties
Edit android/key.properties with your real passwords and paths.
Add before the android { block in android/app/build.gradle:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
Inside android {, add a signingConfigs.release block and set buildTypes.release.signingConfig signingConfigs.release. See Flutter docs: Signing the app.
flutter build appbundle --release
Upload build/app/outputs/bundle/release/app-release.aab to Google Play Console.
iOS App Store
Open ios/Runner.xcworkspace in Xcode β set your Team, unique Bundle Identifier, and provisioning profile β flutter build ipa --release. See the Build & Export section for full commands.
Branding & Customization Guide
Rebrand Almond as your own product β change the name, icon, colors, fonts, and onboarding visuals. Includes visual before-and-after examples.
Visual branding overview
The default Almond theme uses a purple accent (#534CFF) on a dark navy background (#0f1729).
Below you'll find side-by-side mockups and code diffs showing exactly how a rebrand looks before and after editing two key files.
Where to find logos, colors & assets β annotated file map
Each numbered pin points to the exact file or folder to edit. Replace the file, save, then rebuild the app.
β App icon & launcher image
After replacing the icon, run dart run icons_launcher:create to regenerate Android & iOS launcher icons.
β‘ Primary accent color (buttons, tabs, highlights)
β’ App display name
β£ Onboarding illustrations
β€ Fonts
Before & after β logo & app identity
Replace assets/almond_app_icon.png and update the app name in main.dart + platform manifests. The mockups below show the default Almond look vs. a sample rebrand ("VitaFuel" with green accent).
Icon: assets/almond_app_icon.png
Accent: #534CFF
Icon: your 1024Γ1024 PNG
Accent: #10B981 (example)
Before & after β color palette
Primary accent color is defined as onbordingBlue in lib/utils/Colors.dart. Changing this one constant updates buttons, tabs, progress bars, and highlights across the app.
// lib/utils/Colors.dart
Color onbordingBlue = const Color(0xFF534CFF);
Color darkmode = const Color(0xff0f1729);
Color lightPrimary = const Color(0xFF4F46E5);
// lib/utils/Colors.dart
Color onbordingBlue = const Color(0xFF10B981);
Color darkmode = const Color(0xff0c1a14);
Color lightPrimary = const Color(0xFF059669);
Default color reference (editable in Colors.dart)
onbordingBlue #534CFFdarkmode #0f1729lightPrimary #4F46E5gradientColor #00D261redgradient #FF6B6ByelloColor #FFBB0DonbordingBlue, do a full restart (flutter run) β hot reload may not refresh all themed widgets. For light mode, also update lightPrimary, lightSecondary, and mappings in Dark_lightmode.dart.
Rebranding checklist
- Replace
assets/almond_app_icon.pngβ rundart run icons_launcher:create - Update app name in
main.dart,AndroidManifest.xml, andInfo.plist - Edit
onbordingBlueand background colors inlib/utils/Colors.dart - Swap onboarding illustrations in
assets/Steps/ - Replace mascot assets (
assets/almond.png, emoji PNGs) if desired - Optional: change font family in
pubspec.yaml+main.dart
File reference β what to edit
Change the Display Name
Replace the Launcher Icon
Replace assets/almond_app_icon.png with your 1024Γ1024 PNG, then regenerate platform icons:
dart run icons_launcher:create
Config lives in pubspec.yaml under icons_launcher:.
Theme & Color Palette
Typography (Mona Sans)
The app uses Mona Sans (SIL Open Font License) from the fonts/ folder. To swap fonts:
Splash & Onboarding Images
Replace illustrations in assets/Steps/ (goal selection, weight loss, muscle building, etc.) with your own branded artwork. Update references in user_questionnaire_screen.dart if filenames change.
Package / Bundle Identifier
Before publishing, change the app ID to your own:
Step-by-step rebranding walkthrough
1. Change app name
- Open
lib/main.dartβ changetitle: 'Almond'inGetMaterialApp. - Open
android/app/src/main/AndroidManifest.xmlβ updateandroid:label. - Open
ios/Runner/Info.plistβ updateCFBundleDisplayName.
2. Replace logo & app icon
- Replace
assets/almond_app_icon.pngwith your 1024Γ1024 PNG icon. - Run from project root:
dart run icons_launcher:create - Rebuild the app β new icons appear on home screen and app drawer.
3. Customize colors & theme
- Edit accent colors in
lib/utils/Colors.dart(primary blues, greens, backgrounds). - Edit dark/light toggle logic in
lib/utils/Dark_lightmode.dart. - Adjust global
ThemeDatainlib/main.dartif you need Material 3 color scheme changes.
4. Swap fonts (optional)
- Add
.ttffont files to thefonts/folder. - Register font families under
fonts:inpubspec.yaml. - Update
lib/utils/font_family_model.dartandfontFamilyinlib/main.dart. - Run
flutter pub getand restart the app.
5. Onboarding & splash images
- Replace images in
assets/Steps/with your branded illustrations. - Update image paths in
lib/screens/onboarding/user_questionnaire_screen.dartif filenames change. - Replace
assets/almond.pngand other root assets as needed.
6. Change bundle ID before store release
- Android: change
applicationIdinandroid/app/build.gradle. - iOS: open
ios/Runner.xcworkspacein Xcode β Runner target β Signing β set your Bundle Identifier. - Register the new bundle ID in Firebase Console and re-download config files.
Troubleshooting
Common build, Firebase, and runtime issues with quick fixes.
| Problem | Solution |
|---|---|
pod install fails (iOS) |
Run cd ios && pod repo update && pod install && cd ... Ensure Xcode Command Line Tools are installed. |
| Firebase not connecting / empty data | Verify google-services.json and GoogleService-Info.plist are in the correct folders. Set USE_FIREBASE=true in .env.debug. Do a full app restart (not hot reload). |
| AI food recognition not working | Deploy the recognizeFoodImage Cloud Function and set OPENAI_API_KEY via firebase functions:secrets:set. Ensure your OpenAI account has billing enabled. |
.env changes ignored |
Stop the app completely and run flutter run again. Hot reload does not reload environment variables. |
| Gradle / Android build errors | Run flutter clean && flutter pub get, then rebuild. Check Android SDK and Java versions with flutter doctor. |
| White screen on launch | Check debug console for Firebase initialization errors. Confirm Firestore is enabled and config files match your Firebase project. |
| Barcode scan returns no product | The product may not exist in Open Food Facts. Try a known barcode or use manual food search from Firestore. |
| Seed data not appearing | Seeders only run when a collection is empty. Set SEED_FIREBASE_*=true and delete existing documents in Firebase Console, then restart. |
| iOS build signing errors | Open ios/Runner.xcworkspace in Xcode β Signing & Capabilities β select your Team and a unique Bundle Identifier. |
flutter pub get fails |
Run flutter clean, delete pubspec.lock only if needed, then flutter pub get again. Check internet connection and Flutter SDK version (flutter doctor). |
| Firestore permission denied | During seeding, temporarily deploy firestore.rules.seed. After seeding, deploy production firestore.rules (read-only catalog). See Firebase section. |
| App crashes on startup (Android) | Confirm google-services.json is in android/app/ and matches package name com.almond.userapp (or your updated ID). |
| App crashes on startup (iOS) | Confirm GoogleService-Info.plist is in ios/Runner/. Run cd ios && pod install && cd .. after adding Firebase files. |
Demo APK from demo/ won't install |
Enable "Install unknown apps" for your file manager. APK is Android-only. Rebuild with your Firebase config if cloud features fail. |
Still stuck?
Run flutter doctor -v and share the output when requesting support via CodeCanyon comments or email at almonddev673@gmail.com.
Build & Export for Deployment
Step-by-step instructions to compile release builds and publish to Google Play and the Apple App Store.
Before You Ship
Google Play Release
App Store Release
In-App Purchases
Update product IDs in lib/screens/main/subscription/subscription_screen.dart:
Android β build & export commands
For Play Store signing, create a keystore with keytool -genkey -v -keystore upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload,
then configure signing in android/app/build.gradle and android/key.properties (create this file β do not commit passwords to public repos).
iOS β build & export commands
Open ios/Runner.xcworkspace in Xcode to set your Team, Bundle Identifier, and provisioning profile.
Upload the generated IPA using Xcode Organizer or Apple Transporter.
Production Firestore Rules
Shipped in firestore.rules at the project root. Catalog collections are read-only for clients:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /recipes/{document=**} { allow read: if true; allow write: if false; }
match /foods/{document=**} { allow read: if true; allow write: if false; }
match /meal_plans/{document=**} { allow read: if true; allow write: if false; }
match /{document=**} { allow read, write: if false; }
}
}
Use firestore.rules.seed only during initial catalog seeding, then deploy firestore.rules.