# Project export: HealthLink

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 10.0
- Tagline: Meet HealthLink, your AI health companion. Share meals, get advice. Achieve wellness with ease.
- Devpost: https://devpost.com/software/healthlink-fntov4
- GitHub: https://github.com/BustosAndrew/calhack10
- Demo: https://github.com/BustosAndrew/calhacks10/blob/main/functions/index.js
- Team: 3 GitHub contributor(s) — rickNrip (14 commits), ColinH13 (6 commits), Andrew Bustos (3 commits)

## Devpost submission (written by the team)

### Inspiration

We are college students looking to transform the way people interact with AI related to their health.

### What it does

Currently, HealthLink has integrated systems where a user can upload their food info like they are texting their best friend - effortless and fun!

### How we built it

We used Flutter to build our front end, and a server to host our cloud functions to allow the app to connect to openAI.

### Challenges we ran into

The biggest challenge with creating our app was creating proper endpoints.

### Accomplishments we're proud of

We faced a lot of hurdles, but we managed to get a working MVP, and are very proud of our project.

### What we learned

This is one of our teammate's first hackathons, where he learned to create widgets in flutter, as well as create a collection of food items using firebase.

### What's next

This was a test feature for our startup which we plan to integrate in the future so that we can help people with their health-related goals.

## README (from the GitHub repository)

# zeppos

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.


## Detected evidence (automated analysis)

Indexed codebase: 32 recognized source files, 70 KB.
- C (language) — detected in the code
- Dart (language) — detected in the code
- HTML (language) — detected in the code
- Kotlin (language) — detected in the code
- Swift (language) — detected in the code
- Firebase (technology) — claimed on Devpost, not found in the code
- JavaScript (language) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (62 of 62)

```
.gitignore
.metadata
analysis_options.yaml
android/.gitignore
android/app/build.gradle
android/app/google-services.json
android/app/src/debug/AndroidManifest.xml
android/app/src/main/AndroidManifest.xml
android/app/src/main/kotlin/com/example/calhack10/MainActivity.kt
android/app/src/main/kotlin/com/example/zeppos/MainActivity.kt
android/app/src/main/res/drawable-v21/launch_background.xml
android/app/src/main/res/drawable/launch_background.xml
android/app/src/main/res/values-night/styles.xml
android/app/src/main/res/values/styles.xml
android/app/src/profile/AndroidManifest.xml
android/build.gradle
android/gradle.properties
android/gradle/wrapper/gradle-wrapper.properties
android/settings.gradle
ios/.gitignore
ios/Flutter/AppFrameworkInfo.plist
ios/Flutter/Debug.xcconfig
ios/Flutter/Release.xcconfig
ios/Podfile
ios/Podfile.lock
ios/Runner.xcodeproj/project.pbxproj
ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
ios/Runner.xcworkspace/contents.xcworkspacedata
ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
ios/Runner/AppDelegate.swift
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
ios/Runner/Base.lproj/LaunchScreen.storyboard
ios/Runner/Base.lproj/Main.storyboard
ios/Runner/Info.plist
ios/Runner/Runner-Bridging-Header.h
ios/RunnerTests/RunnerTests.swift
lib/AddFoodDB.dart
lib/bottomNavBar.dart
lib/CardForHome.dart
lib/chatRoom.dart
lib/firebase_options.dart
lib/homepage.dart
lib/login.dart
lib/main.dart
lib/mealplan.dart
lib/mealPlansCard.dart
lib/settings.dart
lib/signUp.dart
lib/User_Auth.dart
lib/UserProfile.dart
pubspec.lock
pubspec.yaml
README.md
test/widget_test.dart
web/index.html
web/manifest.json
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- Merge branch 'main' of https://github.com/BustosAndrew/calhack10
- last
- Merge branch 'main' of https://github.com/BustosAndrew/calhack10
- Added Carbs Field
- add new
- fix
- Merge branch 'main' of https://github.com/BustosAndrew/calhack10
- UI for homePage
- Adds a meal plan page
- FixesGoalWeight
- added login and much more
- Changes UI
- adds settings UI
- this adds the bottom nav bar
- fix ios setup
- AddBottomNav
- Update main.dart
- LoginNowWOrks
- fixed conflict
- added firebase/firestore packages

## Key source files (fetched from GitHub, selected and truncated for size)

### analysis_options.yaml

```yaml
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
  # The lint rules applied to this project can be customized in the
  # section below to disable rules from the `package:flutter_lints/flutter.yaml`
  # included above or to enable additional rules. A list of all available lints
  # and their documentation is published at https://dart.dev/lints.
  #
  # Instead of disabling a lint rule for the entire project in the
  # section below, it can also be suppressed for a single line of code
  # or a specific dart file by using the `// ignore: name_of_lint` and
  # `// ignore_for_file: name_of_lint` syntax on the line or in the file
  # producing the lint.
  rules:
    # avoid_print: false  # Uncomment to disable the `avoid_print` rule
    # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

```

### pubspec.yaml

```yaml
name: zeppos
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

environment:
  sdk: ">=3.1.5 <4.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  firebase_core: ^2.20.0
  cloud_firestore: ^4.12.1
  fl_chart: ^0.64.0
  firebase_auth: ^4.12.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

```

### test/widget_test.dart

```dart


```

### lib/main.dart

```dart
import 'package:flutter/material.dart';
import 'package:zeppos/User_Auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:zeppos/homepage.dart';
import 'package:zeppos/login.dart';
import 'firebase_options.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: LoginPage(),
    );
  }
}

```

### lib/mealPlansCard.dart

```dart
import 'package:flutter/material.dart';

class NutritionalFactCard extends StatelessWidget {
  const NutritionalFactCard({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Card(
      margin: EdgeInsets.all(16),
      elevation: 4,
      child: Padding(
        padding: EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const Text(
              'Grilled Chicken Salad', // Meal name
              style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
            ),
            SizedBox(height: 16),
            Text('Nutritional Facts:'),
            SizedBox(height: 10),
            Text('Calories: 250 kcal'), // dummy data
            Text('Protein: 30g'), // dummy data
            Text('Carbohydrates: 20g'), // dummy data
            Text('Fat: 10g'), // dummy data
            SizedBox(height: 16),
            ElevatedButton(
              onPressed: () {
                // Handle "view more" logic here
                print('View More button pressed');
              },
              child: Text('View More'),
            ),
          ],
        ),
      ),
    );
  }
}

```

### lib/settings.dart

```dart
import 'package:flutter/material.dart';
import 'package:zeppos/AddFoodDB.dart';
import 'package:zeppos/UserProfile.dart';

class Settings extends StatelessWidget {
  const Settings({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Settings'),
      ),
      body: ListView(
        children: <Widget>[
          ListTile(
            leading: Icon(Icons.person),
            title: Text('Profile/Personal'),
            onTap: () {
              Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => UserProfilePage()),
              );
            },
          ),
          Divider(),
          ListTile(
            leading: Icon(Icons.note),
            title: Text('Goals/Set a goal'),
            onTap: () {},
          ),
          Divider(),
          ListTile(
            leading: Icon(Icons.palette),
            title: Text('App Theme'),
            onTap: () {},
          ),
          Divider(),
          ListTile(
            leading: Icon(Icons.food_bank),
            title: Text('My Custom Foods'),
            onTap: () {
              Navigator.push(context,
                  MaterialPageRoute(builder: (context) => FoodEntryPage()));
            },
          ),
          Divider(),
          ListTile(
            leading: Icon(Icons.help),
            title: Text('Help?'),
            onTap: () {},
          ),
          Divider(),
          ListTile(
            leading: Icon(Icons.logout),
            title: Text('Logout'),
            onTap: () {},
          ),
        ],
      ),
    );
  }
}

```

### lib/bottomNavBar.dart

```dart
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:zeppos/AddFoodDB.dart';
import 'package:zeppos/chatRoom.dart';
import 'package:zeppos/mealplan.dart';
import 'package:zeppos/settings.dart';

class bottomNavBar extends StatelessWidget {
  const bottomNavBar({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 60,
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(30),
          topRight: Radius.circular(30),
        ),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          IconButton(
              onPressed: () {
                Navigator.push(context,
                    MaterialPageRoute(builder: (context) => MealPage()));
              },
              icon: const Icon(Icons.apple, color: Colors.white)),
          IconButton(
              onPressed: () {},
              icon: const Icon(Icons.bar_chart, color: Colors.white)),
          IconButton(
              onPressed: () {},
              icon: const Icon(Icons.home, color: Colors.white)),
          IconButton(
              onPressed: () {
                Navigator.push(context,
                    MaterialPageRoute(builder: (context) => ChatPage()));
              },
              icon: const Icon(Icons.message_outlined, color: Colors.white)),
          IconButton(
              onPressed: () {
                Navigator.push(context,
                    MaterialPageRoute(builder: (context) => Settings()));
              },
              icon: const Icon(Icons.settings, color: Colors.white)),
        ],
      ),
    );
  }
}

```

### lib/User_Auth.dart

```dart
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';

class AuthService {
  final FirebaseAuth _auth = FirebaseAuth.instance;
  final FirebaseFirestore _firestore = FirebaseFirestore.instance;
  User? get currentUser => _auth.currentUser;

  // Sign in with email & password
  Future signInWithEmailAndPassword(String email, String password) async {
    try {
      UserCredential result = await _auth.signInWithEmailAndPassword(
          email: email, password: password);
      User? user = result.user;
      return user;
    } catch (error) {
      print(error.toString());
      return null;
    }
  }

  Future registerWithEmailAndPassword(String email, String password) async {
    try {
      // 1. Register the user with Firebase Auth
      UserCredential result = await _auth.createUserWithEmailAndPassword(
          email: email, password: password);
      User? user = result.user;

      // 2. Create a document for the user in Firestore
      if (user != null) {
        await _firestore.collection('users').doc(user.uid).set({
          'height': null,
          'weight': null,
          'goalWeight': null,
          'allergies': null,
          'healthIssues': null,
          'goalsugar': 50.0,
          'goalprotein': 51.0,
          'goalcals': 2000.0,
          'goalsodium': 2300.0,
          'goalfat': 70.0,
        });
        await _firestore
            .collection('users')
            .doc(user.uid)
            .collection('dailyMacros')
            .add({
          'calories': null,
          'protein': null,
          'sugar': null,
          'sodium': null,
          'fat': null,
          'vitamins': null,
        });
      }
    } catch (error) {
      print(error.toString());
      return null;
    }
  }
}

```

### web/index.html

```html
<!DOCTYPE html>
<html>
<head>
  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    For more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

    This is a placeholder for base href that will be replaced by the value of
    the `--base-href` argument provided to `flutter build`.
  -->
  <base href="$FLUTTER_BASE_HREF">

  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="A new Flutter project.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="zeppos">
  <link rel="apple-touch-icon" href="icons/Icon-192.png">

  <!-- Favicon -->
  <link rel="icon" type="image/png" href="favicon.png"/>

  <title>zeppos</title>
  <link rel="manifest" href="manifest.json">

  <script>
    // The value below is injected by flutter build, do not touch.
    const serviceWorkerVersion = null;
  </script>
  <!-- This script adds the flutter initialization JS code -->
  <script src="flutter.js" defer></script>
</head>
<body>
  <script>
    window.addEventListener('load', function(ev) {
      // Download main.dart.js
      _flutter.loader.loadEntrypoint({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        },
        onEntrypointLoaded: function(engineInitializer) {
          engineInitializer.initializeEngine().then(function(appRunner) {
            appRunner.runApp();
          });
        }
      });
    });
  </script>
</body>
</html>

```

### lib/firebase_options.dart

```dart
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
    show defaultTargetPlatform, kIsWeb, TargetPlatform;

/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
///   options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
  static FirebaseOptions get currentPlatform {
    if (kIsWeb) {
      return web;
    }
    switch (defaultTargetPlatform) {
      case TargetPlatform.android:
        return android;
      case TargetPlatform.iOS:
        return ios;
      case TargetPlatform.macOS:
        throw UnsupportedError(
          'DefaultFirebaseOptions have not been configured for macos - '
          'you can reconfigure this by running the FlutterFire CLI again.',
        );
      case TargetPlatform.windows:
        throw UnsupportedError(
          'DefaultFirebaseOptions have not been configured for windows - '
          'you can reconfigure this by running the FlutterFire CLI again.',
        );
      case TargetPlatform.linux:
        throw UnsupportedError(
          'DefaultFirebaseOptions have not been configured for linux - '
          'you can reconfigure this by running the FlutterFire CLI again.',
        );
      default:
        throw UnsupportedError(
          'DefaultFirebaseOptions are not supported for this platform.',
        );
    }
  }

  static const FirebaseOptions web = FirebaseOptions(
    apiKey: 'AIzaSyATeaM3Nqw3iSy4zQaSmAQpNv97OTibgKI',
    appId: '1:1093725039822:web:d1751bc326ee2b4ae4f49f',
    messagingSenderId: '1093725039822',
    projectId: 'helflinq',
    authDomain: 'helflinq.firebaseapp.com',
    storageBucket: 'helflinq.appspot.com',
  );

  static const FirebaseOptions android = FirebaseOptions(
    apiKey: 'AIzaSyB8Vwkzu9EtXfITDap7I3WSfVcCcZJshRM',
    appId: '1:1093725039822:android:50b341811dc383b6e4f49f',
    messagingSenderId: '1093725039822',
    projectId: 'helflinq',
    storageBucket: 'helflinq.appspot.com',
  );

  static const FirebaseOptions ios = FirebaseOptions(
    apiKey: 'AIzaSyAQv9EDjLGcuSfgGc21cZfoEe0xGMMnz4M',
    appId: '1:1093725039822:ios:42177ae11afd1b63e4f49f',
    messagingSenderId: '1093725039822',
    projectId: 'helflinq',
    storageBucket: 'helflinq.appspot.com',
    iosBundleId: 'com.example.zeppos',
  );
}

```

[20 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]