├── lib ├── models │ ├── food_source.dart │ ├── sex.dart │ ├── food_conversion.dart │ ├── weight_measurement.dart │ ├── measurement.dart │ ├── activity_level.dart │ ├── units.dart │ └── food.dart ├── blocs │ ├── theme │ │ ├── bloc.dart │ │ ├── theme_state.dart │ │ ├── theme_event.dart │ │ └── theme_bloc.dart │ ├── profile │ │ ├── bloc.dart │ │ ├── profile_event.dart │ │ ├── profile_bloc.dart │ │ └── profile_state.dart │ └── settings │ │ ├── bloc.dart │ │ ├── settings_state.dart │ │ ├── settings_event.dart │ │ └── settings_bloc.dart ├── screens │ ├── foods │ │ ├── bloc │ │ │ ├── bloc.dart │ │ │ ├── foods_event.dart │ │ │ ├── foods_state.dart │ │ │ └── foods_bloc.dart │ │ ├── foods_screen.dart │ │ └── food_details │ │ │ └── food_details_screen.dart │ ├── dashboard │ │ └── dashboard_screen.dart │ └── profile │ │ └── profile_screen.dart ├── data_providers │ ├── foods_provider.dart │ ├── cnf_foods_provider.dart │ ├── local_foods_provider.dart │ └── profile_provider.dart ├── repositories │ ├── settings_repository.dart │ ├── foods_repository.dart │ └── profile_repository.dart ├── log_bloc_delegate.dart ├── themes.dart └── main.dart ├── .gitattributes ├── ios ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── white-logo-1x.png │ │ │ ├── white-logo-2x.png │ │ │ ├── white-logo-3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── .gitignore ├── Podfile.lock └── Podfile ├── working_logo.png ├── fonts ├── PublicSans-Black.ttf ├── PublicSans-Bold.ttf ├── PublicSans-Light.ttf ├── PublicSans-Thin.ttf ├── PublicSans-Italic.ttf ├── PublicSans-Medium.ttf ├── PublicSans-Regular.ttf ├── PublicSans-SemiBold.ttf ├── PublicSans-BoldItalic.ttf ├── PublicSans-ExtraBold.ttf ├── PublicSans-ExtraLight.ttf ├── PublicSans-ThinItalic.ttf ├── PublicSans-BlackItalic.ttf ├── PublicSans-LightItalic.ttf ├── PublicSans-MediumItalic.ttf ├── PublicSans-ExtraBoldItalic.ttf ├── PublicSans-SemiBoldItalic.ttf └── PublicSans-ExtraLightItalic.ttf ├── working_logo_android_fg.png ├── android ├── gradle.properties ├── .gitignore ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ └── launcher_icon.xml │ │ │ │ └── drawable │ │ │ │ │ └── launch_background.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── chubster │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── test └── localdb_test.dart ├── assets └── cnf.db ├── .metadata ├── .gitignore ├── pubspec.yaml ├── README.md ├── working_logo.svg ├── pubspec.lock └── LICENSE /lib/models/food_source.dart: -------------------------------------------------------------------------------- 1 | enum FoodSource { local, cnf } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.db filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /working_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/working_logo.png -------------------------------------------------------------------------------- /fonts/PublicSans-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-Black.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-Bold.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-Light.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-Thin.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-Italic.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-Medium.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-Regular.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-SemiBold.ttf -------------------------------------------------------------------------------- /working_logo_android_fg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/working_logo_android_fg.png -------------------------------------------------------------------------------- /fonts/PublicSans-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-BoldItalic.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-ExtraBold.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-ExtraLight.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-ThinItalic.ttf -------------------------------------------------------------------------------- /lib/blocs/theme/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'theme_bloc.dart'; 2 | export 'theme_event.dart'; 3 | export 'theme_state.dart'; 4 | -------------------------------------------------------------------------------- /fonts/PublicSans-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-BlackItalic.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-LightItalic.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-MediumItalic.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-ExtraBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-ExtraBoldItalic.ttf -------------------------------------------------------------------------------- /fonts/PublicSans-SemiBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-SemiBoldItalic.ttf -------------------------------------------------------------------------------- /lib/blocs/profile/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'profile_bloc.dart'; 2 | export 'profile_event.dart'; 3 | export 'profile_state.dart'; 4 | -------------------------------------------------------------------------------- /lib/screens/foods/bloc/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'foods_bloc.dart'; 2 | export 'foods_event.dart'; 3 | export 'foods_state.dart'; 4 | -------------------------------------------------------------------------------- /fonts/PublicSans-ExtraLightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/fonts/PublicSans-ExtraLightItalic.ttf -------------------------------------------------------------------------------- /lib/blocs/settings/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'settings_bloc.dart'; 2 | export 'settings_event.dart'; 3 | export 'settings_state.dart'; 4 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /test/localdb_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | void main() { 4 | TestWidgetsFlutterBinding.ensureInitialized(); 5 | } -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /assets/cnf.db: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:5faa80a4be4b9a93dfc783228fcdce1e79cb79ee77bbfc57913b192a7743e561 3 | size 2367488 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-hdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-mdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #4caf50 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/white-logo-1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/LaunchImage.imageset/white-logo-1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/white-logo-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/LaunchImage.imageset/white-logo-2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/white-logo-3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/LaunchImage.imageset/white-logo-3x.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamaluik/chubster/master/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lib/data_providers/foods_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/food.dart'; 2 | import 'package:chubster/models/food_conversion.dart'; 3 | 4 | abstract class FoodsProvider { 5 | Future> searchForFoodByName(String name); 6 | Future> getConversionsForFood(int sourceID); 7 | } 8 | -------------------------------------------------------------------------------- /lib/models/sex.dart: -------------------------------------------------------------------------------- 1 | enum Sex { male, female, other } 2 | 3 | extension SexStr on Sex { 4 | String get stringify { 5 | switch(this) { 6 | case Sex.male: return "Male"; 7 | case Sex.female: return "Female"; 8 | case Sex.other: return "Other"; 9 | } 10 | return "null"; 11 | } 12 | } -------------------------------------------------------------------------------- /lib/models/food_conversion.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class FoodConversion extends Equatable { 4 | final String description; 5 | final double factor; 6 | 7 | FoodConversion(this.description, this.factor); 8 | 9 | @override List get props => [description, factor]; 10 | } -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/launcher_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/screens/dashboard/dashboard_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class DashboardScreen extends StatelessWidget { 4 | const DashboardScreen({Key key}) : super(key: key); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return Container( 9 | child: Center( 10 | child: Text("Dashboard") 11 | ) 12 | ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /lib/repositories/settings_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | class SettingsRepository { 4 | final SharedPreferences prefs; 5 | SettingsRepository(this.prefs); 6 | 7 | static Future load() async { 8 | SharedPreferences prefs = await SharedPreferences.getInstance(); 9 | return SettingsRepository(prefs); 10 | } 11 | } -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /lib/blocs/theme/theme_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class ThemeState extends Equatable { 5 | final Brightness brightness; 6 | final ThemeData theme; 7 | 8 | const ThemeState({@required this.brightness, @required this.theme}) 9 | : assert(theme != null); 10 | 11 | @override 12 | List get props => [brightness]; 13 | } 14 | -------------------------------------------------------------------------------- /lib/screens/foods/bloc/foods_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class FoodsEvent extends Equatable { 4 | const FoodsEvent(); 5 | } 6 | 7 | class SearchTermChangedEvent extends FoodsEvent { 8 | final String searchTerm; 9 | final bool localActive; 10 | final bool cnfActive; 11 | SearchTermChangedEvent(this.searchTerm, this.localActive, this.cnfActive); 12 | 13 | @override List get props => [searchTerm]; 14 | } 15 | -------------------------------------------------------------------------------- /lib/blocs/theme/theme_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | abstract class ThemeEvent extends Equatable { 5 | const ThemeEvent(); 6 | } 7 | 8 | class BrightnessChanged extends ThemeEvent { 9 | final Brightness brightness; 10 | 11 | const BrightnessChanged({@required this.brightness}) 12 | : assert(brightness != null); 13 | 14 | @override 15 | List get props => [brightness]; 16 | } 17 | -------------------------------------------------------------------------------- /lib/screens/foods/bloc/foods_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/food.dart'; 2 | 3 | abstract class FoodsState { 4 | const FoodsState(); 5 | } 6 | 7 | class EmptyFoodsState extends FoodsState { 8 | } 9 | 10 | class SearchingFoodsState extends FoodsState { 11 | } 12 | 13 | class SearchResultsFoodsState extends FoodsState { 14 | final List foods; 15 | SearchResultsFoodsState(this.foods); 16 | } 17 | 18 | class SearchingFoodsError extends FoodsState { 19 | } -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/models/weight_measurement.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/units.dart'; 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter/foundation.dart'; 4 | 5 | class WeightMeasurement extends Equatable { 6 | final DateTime timestamp; 7 | final WeightUnits weight; 8 | 9 | WeightMeasurement({this.timestamp, @required this.weight}) 10 | : assert(weight != null); 11 | 12 | @override 13 | List get props => [timestamp, weight]; 14 | } 15 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/chubster/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.chubster 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "white-logo-1x.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "white-logo-2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "white-logo-3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /lib/models/measurement.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/units.dart'; 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter/foundation.dart'; 4 | 5 | class Measurement extends Equatable { 6 | final String measurement; 7 | final DateTime timestamp; 8 | final LengthUnits length; 9 | 10 | Measurement({@required this.measurement, this.timestamp, this.length}) 11 | : assert(measurement != null), 12 | assert(length != null); 13 | 14 | @override 15 | List get props => [measurement, timestamp, length]; 16 | } 17 | -------------------------------------------------------------------------------- /lib/log_bloc_delegate.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | 3 | class LogBlocDelegate extends BlocDelegate { 4 | @override 5 | void onEvent(Bloc bloc, Object event) { 6 | super.onEvent(bloc, event); 7 | print('onEvent $event'); 8 | } 9 | 10 | @override 11 | onTransition(Bloc bloc, Transition transition) { 12 | super.onTransition(bloc, transition); 13 | print('onTransition $transition'); 14 | } 15 | 16 | @override 17 | void onError(Bloc bloc, Object error, StackTrace stacktrace) { 18 | super.onError(bloc, error, stacktrace); 19 | print('onError $error'); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /lib/themes.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final ThemeData lightTheme = new ThemeData( 4 | brightness: Brightness.light, 5 | primarySwatch: Colors.green, 6 | primaryColor: Colors.green[500], 7 | primaryColorBrightness: Brightness.dark, 8 | accentColor: Colors.green[500], 9 | accentColorBrightness: Brightness.dark, 10 | fontFamily: 'PublicSans', 11 | ); 12 | 13 | final ThemeData darkTheme = new ThemeData( 14 | brightness: Brightness.dark, 15 | primarySwatch: Colors.grey, 16 | primaryColor: Colors.grey[900], 17 | primaryColorBrightness: Brightness.dark, 18 | accentColor: Colors.green[500], 19 | accentColorBrightness: Brightness.light, 20 | fontFamily: 'PublicSans', 21 | ); 22 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /lib/blocs/settings/settings_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | 4 | class SettingsState extends Equatable { 5 | final bool cnfActive; 6 | final bool localActive; 7 | 8 | SettingsState({@required this.cnfActive, @required this.localActive}); 9 | SettingsState.initial() 10 | : this.cnfActive = true, 11 | this.localActive = true; 12 | 13 | SettingsState.clone(SettingsState settings, 14 | {bool cnfActive, bool localActive}) 15 | : this( 16 | cnfActive: cnfActive ?? settings.cnfActive, 17 | localActive: localActive ?? settings.localActive, 18 | ); 19 | 20 | @override List get props => [cnfActive, localActive]; 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /lib/blocs/settings/settings_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/food_source.dart'; 2 | import 'package:equatable/equatable.dart'; 3 | 4 | abstract class SettingsEvent extends Equatable { 5 | const SettingsEvent(); 6 | } 7 | 8 | class LoadSettingsFromRepository extends SettingsEvent { 9 | @override List get props => []; 10 | } 11 | 12 | class SetFoodsSourceEvent extends SettingsEvent { 13 | final FoodSource source; 14 | final bool active; 15 | SetFoodsSourceEvent(this.source, this.active); 16 | 17 | @override List get props => [source, active]; 18 | } 19 | 20 | class ToggleFoodsSourceEvent extends SettingsEvent { 21 | final FoodSource source; 22 | ToggleFoodsSourceEvent(this.source); 23 | 24 | @override List get props => [source]; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/blocs/theme/theme_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:bloc/bloc.dart'; 3 | import 'package:chubster/themes.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import './bloc.dart'; 7 | 8 | class ThemeBloc extends Bloc { 9 | @override 10 | ThemeState get initialState => ThemeState( 11 | brightness: WidgetsBinding.instance.window.platformBrightness, 12 | theme: WidgetsBinding.instance.window.platformBrightness == 13 | Brightness.light 14 | ? lightTheme 15 | : darkTheme, 16 | ); 17 | 18 | @override 19 | Stream mapEventToState(ThemeEvent event) async* { 20 | if (event is BrightnessChanged) { 21 | switch (event.brightness) { 22 | case Brightness.dark: 23 | { 24 | yield new ThemeState(brightness: Brightness.dark, theme: darkTheme); 25 | break; 26 | } 27 | case Brightness.light: 28 | { 29 | yield new ThemeState( 30 | brightness: Brightness.light, theme: lightTheme); 31 | break; 32 | } 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/repositories/foods_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/data_providers/cnf_foods_provider.dart'; 2 | import 'package:chubster/data_providers/local_foods_provider.dart'; 3 | import 'package:chubster/models/food.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | 6 | class FoodsRepository { 7 | final LocalFoodsProvider _local; 8 | final CNFFoodsProvider _cnf; 9 | 10 | FoodsRepository(this._local, this._cnf) 11 | : assert(_local != null), 12 | assert(_cnf != null); 13 | 14 | Future> searchForFoodByName(String name, {@required bool localActive, @required bool cnfActive}) async { 15 | List>> searches = []; 16 | if(localActive) searches.add(_local.searchForFoodByName(name)); 17 | if(cnfActive) searches.add(_cnf.searchForFoodByName(name)); 18 | 19 | List> databaseFoods = await Future.wait(searches); 20 | 21 | // https://stackoverflow.com/questions/15413248/how-to-flatten-a-list 22 | return databaseFoods.expand((i) => i).toList(); 23 | } 24 | 25 | Future createFood(Food food) async { 26 | return await _local?.createFood(food); 27 | } 28 | 29 | static Future open() async { 30 | LocalFoodsProvider local = await LocalFoodsProvider.open(); 31 | CNFFoodsProvider cnf = await CNFFoodsProvider.open(); 32 | FoodsRepository repo = FoodsRepository(local, cnf); 33 | return repo; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/screens/foods/bloc/foods_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:bloc/bloc.dart'; 3 | import 'package:chubster/repositories/foods_repository.dart'; 4 | import 'package:flutter_bloc/flutter_bloc.dart'; 5 | import 'package:chubster/models/food.dart'; 6 | import './bloc.dart'; 7 | import 'bloc.dart'; 8 | 9 | class FoodsBloc extends Bloc { 10 | final FoodsRepository foodsRepo; 11 | FoodsBloc(this.foodsRepo) : assert(foodsRepo != null) { 12 | print('created foods bloc'); 13 | } 14 | 15 | @override 16 | FoodsState get initialState => EmptyFoodsState(); 17 | 18 | @override 19 | Stream mapEventToState( 20 | FoodsEvent event, 21 | ) async* { 22 | print("FoodsEvent received: " + event.toString()); 23 | if(event is SearchTermChangedEvent) { 24 | if(event.searchTerm == null || event.searchTerm.trim().length < 1) { 25 | yield SearchResultsFoodsState([]); 26 | } 27 | else { 28 | print("searching..."); 29 | yield SearchingFoodsState(); 30 | try { 31 | List foods = await foodsRepo.searchForFoodByName(event.searchTerm, localActive: event.localActive, cnfActive: event.cnfActive); 32 | print('found ${foods.length} foods!'); 33 | yield SearchResultsFoodsState(foods); 34 | } 35 | catch(_) { 36 | print('error!'); 37 | yield SearchingFoodsError(); 38 | } 39 | print('done _loadEvent'); 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/models/activity_level.dart: -------------------------------------------------------------------------------- 1 | enum ActivityLevel { sedentary, light, moderate, very, extra } 2 | 3 | extension ActivityLevelMultipler on ActivityLevel { 4 | /// Resting energy multiplier 5 | /// 6 | /// From: https://www.iifym.com/tdee-calculator/total-daily-energy-expenditure/what-is-the-tdee-formula-how-is-it-related-to-bmr/ 7 | double get multiplier { 8 | switch(this) { 9 | case ActivityLevel.sedentary: return 1.2; 10 | case ActivityLevel.light: return 1.375; 11 | case ActivityLevel.moderate: return 1.55; 12 | case ActivityLevel.very: return 1.725; 13 | case ActivityLevel.extra: return 1.9; 14 | } 15 | return 1.0; 16 | } 17 | } 18 | 19 | extension ActivityLevelStr on ActivityLevel { 20 | String get stringify { 21 | switch(this) { 22 | case ActivityLevel.sedentary: return "Sedentary"; 23 | case ActivityLevel.light: return "Light Activity"; 24 | case ActivityLevel.moderate: return "Moderate Activity"; 25 | case ActivityLevel.very: return "Very Active"; 26 | case ActivityLevel.extra: return "Extra Active"; 27 | } 28 | return "null"; 29 | } 30 | 31 | String get description { 32 | switch(this) { 33 | case ActivityLevel.sedentary: return "little or no exercise"; 34 | case ActivityLevel.light: return "light exercise 1–3 days / week"; 35 | case ActivityLevel.moderate: return "moderate exercise 3–5 days / week"; 36 | case ActivityLevel.very: return "hard exercise 6–7 days / week"; 37 | case ActivityLevel.extra: return "very hard exercise 6–7 days / week + physical job"; 38 | } 39 | return "null"; 40 | } 41 | } -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /lib/blocs/profile/profile_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/activity_level.dart'; 2 | import 'package:chubster/models/sex.dart'; 3 | import 'package:chubster/models/units.dart'; 4 | import 'package:equatable/equatable.dart'; 5 | 6 | abstract class ProfileEvent extends Equatable { 7 | const ProfileEvent(); 8 | } 9 | 10 | class LoadProfileFromRepository extends ProfileEvent { 11 | @override List get props => []; 12 | } 13 | 14 | class SetBirthday extends ProfileEvent { 15 | final DateTime newBirthday; 16 | SetBirthday(this.newBirthday); 17 | 18 | @override List get props => [newBirthday]; 19 | } 20 | 21 | class ChangeSex extends ProfileEvent { 22 | final Sex newSex; 23 | ChangeSex(this.newSex); 24 | 25 | @override List get props => [newSex]; 26 | } 27 | 28 | class ChangeActivityLevel extends ProfileEvent { 29 | final ActivityLevel newLevel; 30 | ChangeActivityLevel(this.newLevel); 31 | 32 | @override List get props => [newLevel]; 33 | } 34 | 35 | class SetHeight extends ProfileEvent { 36 | final LengthUnits newHeight; 37 | SetHeight(this.newHeight); 38 | 39 | @override List get props => [newHeight]; 40 | } 41 | 42 | /// Update the in-memory weight, but don't persist it to disk. Emit `RecordWeight` _after_ SetWeight to save the weight 43 | class SetWeight extends ProfileEvent { 44 | final WeightUnits newWeight; 45 | SetWeight(this.newWeight); 46 | 47 | @override List get props => [newWeight]; 48 | } 49 | 50 | /// Save the current weight to the database, effectively manually debouncing `SetWeight` 51 | class RecordWeight extends ProfileEvent { 52 | @override List get props => []; 53 | } 54 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | chubster 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /lib/blocs/profile/profile_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:bloc/bloc.dart'; 3 | import 'package:chubster/repositories/profile_repository.dart'; 4 | import 'package:just_debounce_it/just_debounce_it.dart'; 5 | import './bloc.dart'; 6 | 7 | class ProfileBloc extends Bloc { 8 | final ProfileRepository _profile; 9 | ProfileBloc(this._profile); 10 | 11 | @override 12 | ProfileState get initialState => ProfileState(); 13 | 14 | @override 15 | Stream mapEventToState( 16 | ProfileEvent event, 17 | ) async* { 18 | if(event is LoadProfileFromRepository) { 19 | yield await ProfileState.initial(_profile); 20 | } 21 | else if(event is SetBirthday) { 22 | Debounce.milliseconds(500, () => _profile.setBirthday(event.newBirthday)); 23 | yield ProfileState.clone(state, birthday: event.newBirthday); 24 | } 25 | else if(event is ChangeSex) { 26 | Debounce.milliseconds(500, () => _profile.setSex(event.newSex)); 27 | yield ProfileState.clone(state, sex: event.newSex); 28 | } 29 | else if(event is ChangeActivityLevel) { 30 | Debounce.milliseconds(500, () => _profile.setActivityLevel(event.newLevel)); 31 | yield ProfileState.clone(state, activityLevel: event.newLevel); 32 | } 33 | else if(event is SetHeight) { 34 | Debounce.milliseconds(500, () => _profile.setHeight(event.newHeight)); 35 | yield ProfileState.clone(state, height: event.newHeight); 36 | } 37 | else if(event is SetWeight) { 38 | yield ProfileState.clone(state, weight: event.newWeight); 39 | } 40 | else if(event is RecordWeight) { 41 | await _profile.recordWeight(state.weight); 42 | yield state; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/blocs/settings/settings_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:bloc/bloc.dart'; 3 | import 'package:chubster/models/food_source.dart'; 4 | import 'package:chubster/repositories/settings_repository.dart'; 5 | import './bloc.dart'; 6 | 7 | class SettingsBloc extends Bloc { 8 | final SettingsRepository settings; 9 | SettingsBloc(this.settings); 10 | 11 | @override 12 | SettingsState get initialState => SettingsState.initial(); 13 | 14 | @override 15 | Stream mapEventToState( 16 | SettingsEvent event, 17 | ) async* { 18 | if(event is LoadSettingsFromRepository) { 19 | bool localActive = settings.prefs.getBool("localActive") ?? state.localActive; 20 | bool cnfActive = settings.prefs.getBool("cnfActive") ?? state.cnfActive; 21 | yield SettingsState(localActive: localActive, cnfActive: cnfActive); 22 | } 23 | else if(event is SetFoodsSourceEvent) { 24 | switch(event.source) { 25 | case FoodSource.local: 26 | await settings.prefs.setBool("localActive", event.active); 27 | yield SettingsState.clone(state, localActive: event.active); 28 | break; 29 | case FoodSource.cnf: 30 | await settings.prefs.setBool("cnfActive", event.active); 31 | yield SettingsState.clone(state, cnfActive: event.active); 32 | break; 33 | } 34 | } 35 | else if(event is ToggleFoodsSourceEvent) { 36 | switch(event.source) { 37 | case FoodSource.local: 38 | await settings.prefs.setBool("localActive", !state.localActive); 39 | yield SettingsState.clone(state, localActive: !state.localActive); 40 | break; 41 | case FoodSource.cnf: 42 | await settings.prefs.setBool("cnfActive", !state.cnfActive); 43 | yield SettingsState.clone(state, cnfActive: !state.cnfActive); 44 | break; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "ca.hamaluik.chubster" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - FMDB (2.7.5): 4 | - FMDB/standard (= 2.7.5) 5 | - FMDB/standard (2.7.5) 6 | - shared_preferences (0.0.1): 7 | - Flutter 8 | - shared_preferences_macos (0.0.1): 9 | - Flutter 10 | - shared_preferences_web (0.0.1): 11 | - Flutter 12 | - sqflite (0.0.1): 13 | - Flutter 14 | - FMDB (~> 2.7.2) 15 | - url_launcher (0.0.1): 16 | - Flutter 17 | - url_launcher_macos (0.0.1): 18 | - Flutter 19 | - url_launcher_web (0.0.1): 20 | - Flutter 21 | 22 | DEPENDENCIES: 23 | - Flutter (from `Flutter`) 24 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) 25 | - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) 26 | - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) 27 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 28 | - url_launcher (from `.symlinks/plugins/url_launcher/ios`) 29 | - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) 30 | - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) 31 | 32 | SPEC REPOS: 33 | trunk: 34 | - FMDB 35 | 36 | EXTERNAL SOURCES: 37 | Flutter: 38 | :path: Flutter 39 | shared_preferences: 40 | :path: ".symlinks/plugins/shared_preferences/ios" 41 | shared_preferences_macos: 42 | :path: ".symlinks/plugins/shared_preferences_macos/ios" 43 | shared_preferences_web: 44 | :path: ".symlinks/plugins/shared_preferences_web/ios" 45 | sqflite: 46 | :path: ".symlinks/plugins/sqflite/ios" 47 | url_launcher: 48 | :path: ".symlinks/plugins/url_launcher/ios" 49 | url_launcher_macos: 50 | :path: ".symlinks/plugins/url_launcher_macos/ios" 51 | url_launcher_web: 52 | :path: ".symlinks/plugins/url_launcher_web/ios" 53 | 54 | SPEC CHECKSUMS: 55 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 56 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 57 | shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01 58 | shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 59 | shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 60 | sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0 61 | url_launcher: a1c0cc845906122c4784c542523d8cacbded5626 62 | url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 63 | url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c 64 | 65 | PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83 66 | 67 | COCOAPODS: 1.8.4 68 | -------------------------------------------------------------------------------- /lib/data_providers/cnf_foods_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'dart:typed_data'; 3 | import 'package:chubster/models/food_conversion.dart'; 4 | import 'package:chubster/models/food_source.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:path/path.dart' as p; 7 | import 'package:chubster/data_providers/foods_provider.dart'; 8 | import 'package:chubster/models/food.dart'; 9 | import 'package:sqflite/sqflite.dart'; 10 | 11 | class CNFFoodsProvider extends FoodsProvider { 12 | final Database _db; 13 | 14 | CNFFoodsProvider(this._db) : assert(_db != null); 15 | 16 | @override 17 | Future> searchForFoodByName(String name) async { 18 | List results = await _db 19 | .rawQuery('select * from foods where name like ?', ['%$name%']); 20 | List foods = 21 | results.map((food) => Food.fromJson(food, FoodSource.cnf)).toList(); 22 | return foods; 23 | } 24 | 25 | @override 26 | Future> getConversionsForFood(int sourceID) async { 27 | List results = await _db.rawQuery("select description, conversion_factor from conversions inner join measurements on measurements.id=conversions.measurement_id where food_id=?", [sourceID]); 28 | List conversions = results.map((row) => FoodConversion(row['description'], row['conversion_factor'])).toList(); 29 | return conversions; 30 | } 31 | 32 | static Future open() async { 33 | // get a path to the database file 34 | var databasesPath = await getDatabasesPath(); 35 | var path = p.join(databasesPath, 'foods.cnf.db'); 36 | var exists = await databaseExists(path); 37 | 38 | // from https://github.com/tekartik/sqflite/blob/master/sqflite/doc/opening_asset_db.md 39 | if(!exists) { 40 | print("CNF database not installed, installing now..."); 41 | // make sure the path exists 42 | await Directory(p.dirname(path)).create(recursive: true); 43 | 44 | // copy the database from the asset 45 | print("Loading cnf.db"); 46 | ByteData data = await rootBundle.load(p.join("assets", "cnf.db")); 47 | List bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); 48 | 49 | // write and flush the bytes written 50 | print("Copying cnf.db to disk"); 51 | await File(path).writeAsBytes(bytes, flush: true); 52 | print("Done installing cnf.db!"); 53 | } 54 | 55 | // open the database 56 | Database db = await openDatabase(path, readOnly: true); 57 | CNFFoodsProvider repo = CNFFoodsProvider(db); 58 | 59 | return repo; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: chubster 2 | description: A private-first nutrition journal 3 | 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ">=2.6.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | flutter_bloc: ^3.1.0 13 | equatable: ^1.0.0 14 | fancy_bottom_navigation: ^0.3.2 15 | font_awesome_flutter: ^8.5.0 16 | sqflite: ^1.2.0 17 | just_debounce_it: ^3.0.0+2 18 | loading_indicator: ^1.0.0 19 | shared_preferences: ^0.5.6 20 | flutter_scale: ^0.1.2 21 | intl: ^0.16.1 22 | url_launcher: ^5.4.1 23 | 24 | dev_dependencies: 25 | flutter_test: 26 | sdk: flutter 27 | flutter_launcher_icons: ^0.7.4 28 | 29 | flutter_icons: 30 | android: "launcher_icon" 31 | ios: true 32 | image_path: "working_logo.png" 33 | adaptive_icon_background: "#4caf50" 34 | adaptive_icon_foreground: "working_logo_android_fg.png" 35 | 36 | flutter: 37 | uses-material-design: true 38 | assets: 39 | - assets/cnf.db 40 | fonts: 41 | - family: PublicSans 42 | fonts: 43 | - asset: fonts/PublicSans-Thin.ttf 44 | weight: 100 45 | - asset: fonts/PublicSans-ThinItalic.ttf 46 | weight: 100 47 | style: italic 48 | - asset: fonts/PublicSans-ExtraLight.ttf 49 | weight: 200 50 | - asset: fonts/PublicSans-ExtraLightItalic.ttf 51 | weight: 200 52 | style: italic 53 | - asset: fonts/PublicSans-Light.ttf 54 | weight: 300 55 | - asset: fonts/PublicSans-LightItalic.ttf 56 | weight: 300 57 | style: italic 58 | - asset: fonts/PublicSans-Regular.ttf 59 | weight: 400 60 | - asset: fonts/PublicSans-Italic.ttf 61 | weight: 400 62 | style: italic 63 | - asset: fonts/PublicSans-Medium.ttf 64 | weight: 500 65 | - asset: fonts/PublicSans-MediumItalic.ttf 66 | weight: 500 67 | style: italic 68 | - asset: fonts/PublicSans-SemiBold.ttf 69 | weight: 600 70 | - asset: fonts/PublicSans-SemiBoldItalic.ttf 71 | weight: 600 72 | style: italic 73 | - asset: fonts/PublicSans-Bold.ttf 74 | weight: 700 75 | - asset: fonts/PublicSans-BoldItalic.ttf 76 | weight: 700 77 | style: italic 78 | - asset: fonts/PublicSans-ExtraBold.ttf 79 | weight: 800 80 | - asset: fonts/PublicSans-ExtraBoldItalic.ttf 81 | weight: 800 82 | style: italic 83 | - asset: fonts/PublicSans-Black.ttf 84 | weight: 900 85 | - asset: fonts/PublicSans-BlackItalic.ttf 86 | weight: 900 87 | style: italic 88 | -------------------------------------------------------------------------------- /lib/repositories/profile_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/data_providers/profile_provider.dart'; 2 | import 'package:chubster/models/activity_level.dart'; 3 | import 'package:chubster/models/measurement.dart'; 4 | import 'package:chubster/models/sex.dart'; 5 | import 'package:chubster/models/units.dart'; 6 | import 'package:chubster/models/weight_measurement.dart'; 7 | import 'package:shared_preferences/shared_preferences.dart'; 8 | 9 | class ProfileRepository { 10 | final ProfileProvider _profile; 11 | final SharedPreferences _prefs; 12 | 13 | ProfileRepository(this._profile, this._prefs) 14 | : assert(_profile != null) 15 | , assert(_prefs != null); 16 | 17 | DateTime getBirthday() { 18 | int ts = _prefs.getInt("birthday"); 19 | if(ts == null) { 20 | return DateTime.now().subtract(Duration(days: (365.25 * 30.0).ceil())); 21 | } 22 | return DateTime.fromMillisecondsSinceEpoch(ts); 23 | } 24 | 25 | Future setBirthday(DateTime birthday) async { 26 | int ts = birthday.millisecondsSinceEpoch; 27 | await _prefs.setInt("birthday", ts); 28 | } 29 | 30 | LengthUnits getHeight() { 31 | double height = _prefs.getDouble("height"); 32 | if(height == null) return null; 33 | return Meters(height); 34 | } 35 | 36 | Future setHeight(LengthUnits height) async { 37 | await _prefs.setDouble("height", height.toMeters().value); 38 | } 39 | 40 | Sex getSex() { 41 | String sexStr = _prefs.getString("sex"); 42 | Sex sex = Sex.other; 43 | if(sexStr != null) { 44 | sex = Sex.values.firstWhere((e) => e.toString() == sexStr); 45 | } 46 | return sex; 47 | } 48 | 49 | Future setSex(Sex sex) async { 50 | await _prefs.setString("sex", sex.toString()); 51 | } 52 | 53 | ActivityLevel getActivityLevel() { 54 | String activityStr = _prefs.getString("activityLevel"); 55 | ActivityLevel activityLevel = ActivityLevel.sedentary; 56 | if(activityStr != null) { 57 | activityLevel = ActivityLevel.values.firstWhere((e) => e.toString() == activityStr); 58 | } 59 | return activityLevel; 60 | } 61 | 62 | Future setActivityLevel(ActivityLevel activityLevel) async { 63 | await _prefs.setString("activityLevel", activityLevel.toString()); 64 | } 65 | 66 | Future getCurrentWeight() async { 67 | WeightMeasurement measurement = await _profile.getLatestWeight(); 68 | return measurement?.weight; 69 | } 70 | 71 | Future recordWeight(WeightUnits weight) async { 72 | await _profile.recordWeight(weight); 73 | } 74 | 75 | static Future open() async { 76 | List futures = await Future.wait([ProfileProvider.open(), SharedPreferences.getInstance()]); 77 | ProfileRepository repo = ProfileRepository(futures[0], futures[1]); 78 | 79 | return repo; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/models/units.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class Units extends Equatable { 4 | String get unitsStr; 5 | } 6 | 7 | abstract class WeightUnits extends Units { 8 | final double _grams; 9 | WeightUnits(this._grams); 10 | 11 | List get props => [_grams]; 12 | double get _scale => 1.0; 13 | double get value => _grams * _scale; 14 | @override String get unitsStr => "g"; 15 | 16 | Grams toGrams() => Grams(this._grams); 17 | KiloGrams toKiloGrams() => KiloGrams(this._grams * 0.001); 18 | MilliGrams toMilliGrams() => MilliGrams(this._grams * 1000.0); 19 | Oz toOz() => Oz(this._grams * 0.03527396); 20 | Lbs toLbs() => Lbs(this._grams * 0.002204623); 21 | } 22 | 23 | class Grams extends WeightUnits { 24 | Grams(double g) : super(g); 25 | @override double get _scale => 1.0; 26 | @override String get unitsStr => "g"; 27 | } 28 | 29 | class KiloGrams extends WeightUnits { 30 | KiloGrams(double kg) : super(kg * 1000.0); 31 | @override double get _scale => 0.001; 32 | @override String get unitsStr => "kg"; 33 | } 34 | 35 | class MilliGrams extends WeightUnits { 36 | MilliGrams(double mg) : super(mg * 0.001); 37 | @override double get _scale => 1000.0; 38 | @override String get unitsStr => "mg"; 39 | } 40 | 41 | class Oz extends WeightUnits { 42 | Oz(double oz) : super(oz * 28.34952); 43 | @override double get _scale => 0.03527396; 44 | @override String get unitsStr => "oz"; 45 | } 46 | 47 | class Lbs extends WeightUnits { 48 | Lbs(double lbs) : super(lbs * 453.5924); 49 | @override double get _scale => 0.002204623; 50 | @override String get unitsStr => "lbs"; 51 | } 52 | 53 | abstract class LengthUnits extends Units { 54 | final double _meters; 55 | LengthUnits(this._meters); 56 | 57 | List get props => [_meters]; 58 | double get _scale => 1.0; 59 | double get value => _meters * _scale; 60 | @override String get unitsStr => "m"; 61 | 62 | Meters toMeters() => Meters(this._meters); 63 | CentiMeters toCentiMeters() => CentiMeters(this._meters * 100.0); 64 | Feet toFeet() => Feet(this._meters * 3.28084); 65 | Inches toInches() => Inches(this._meters * 39.37008); 66 | } 67 | 68 | class Meters extends LengthUnits { 69 | Meters(double m) : super(m); 70 | @override double get _scale => 1.0; 71 | @override String get unitsStr => "m"; 72 | } 73 | 74 | class CentiMeters extends LengthUnits { 75 | CentiMeters(double cm) : super(cm * 0.01); 76 | @override double get _scale => 100.0; 77 | @override String get unitsStr => "cm"; 78 | } 79 | 80 | class Feet extends LengthUnits { 81 | Feet(double ft) : super(ft * 0.3048); 82 | @override double get _scale => 3.28084; 83 | @override String get unitsStr => "ft"; 84 | } 85 | 86 | class Inches extends LengthUnits { 87 | Inches(double inches) : super(inches * 0.0254); 88 | @override double get _scale => 39.37008; 89 | @override String get unitsStr => "in"; 90 | } 91 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } -------------------------------------------------------------------------------- /lib/blocs/profile/profile_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/activity_level.dart'; 2 | import 'package:chubster/models/sex.dart'; 3 | import 'package:chubster/models/units.dart'; 4 | import 'package:chubster/repositories/profile_repository.dart'; 5 | import 'package:equatable/equatable.dart'; 6 | import 'dart:math'; 7 | 8 | class ProfileState extends Equatable { 9 | final Sex sex; 10 | final ActivityLevel activityLevel; 11 | final LengthUnits height; 12 | final WeightUnits weight; 13 | final DateTime birthday; 14 | ProfileState( 15 | {this.sex, this.activityLevel, this.height, this.weight, this.birthday}); 16 | 17 | double get bmi { 18 | if (this.weight == null) return null; 19 | if (this.height == null) return null; 20 | if (this.height.value <= double.minPositive) return null; 21 | return this.weight.toKiloGrams().value / pow(height.toMeters().value, 2); 22 | } 23 | 24 | /// The age of the person in years 25 | double get age { 26 | return DateTime.now().difference(birthday).inDays.toDouble() / 365.25; 27 | } 28 | 29 | /// The estimated body fat percent (0–100) 30 | /// 31 | /// https://en.wikipedia.org/wiki/Body_fat_percentage#From_BMI 32 | double get bodyFatPercent { 33 | double b = bmi; 34 | if (b == null) return null; 35 | if (birthday == null) return null; 36 | if (sex == null) return null; 37 | 38 | double bf = (1.39 * b) + (0.16 * age) - (9); 39 | if (sex == Sex.male) bf -= 10.34; 40 | return bf; 41 | } 42 | 43 | /// The resting daily energy expenditure in kCal / day 44 | /// 45 | /// From the Katch-McArdle formula: 46 | /// https://en.wikipedia.org/wiki/Basal_metabolic_rate#BMR_estimation_formulas 47 | double get restingDailyEnergy { 48 | double m = this.weight?.toKiloGrams()?.value; 49 | double f = this.bodyFatPercent; 50 | if (m == null || f == null) return null; 51 | double l = m * (1.0 - (f / 100.0)); 52 | return 370.0 + (21.6 * l); 53 | } 54 | 55 | double get totalDailyEnergy { 56 | double r = this.restingDailyEnergy; 57 | if(this.restingDailyEnergy == null) return null; 58 | double m = this.activityLevel?.multiplier; 59 | if(m == null) return null; 60 | return r * m; 61 | } 62 | 63 | static Future initial(ProfileRepository repository) async { 64 | Sex sex = repository.getSex(); 65 | ActivityLevel activityLevel = repository.getActivityLevel(); 66 | LengthUnits height = repository.getHeight(); 67 | WeightUnits weight = await repository.getCurrentWeight(); 68 | DateTime birthday = repository.getBirthday(); 69 | return ProfileState( 70 | sex: sex, 71 | activityLevel: activityLevel, 72 | height: height, 73 | weight: weight, 74 | birthday: birthday); 75 | } 76 | 77 | ProfileState.clone(ProfileState profile, 78 | {Sex sex, 79 | ActivityLevel activityLevel, 80 | LengthUnits height, 81 | WeightUnits weight, 82 | DateTime birthday}) 83 | : this( 84 | sex: sex ?? profile.sex, 85 | activityLevel: activityLevel ?? profile.activityLevel, 86 | height: height ?? profile.height, 87 | weight: weight ?? profile.weight, 88 | birthday: birthday ?? profile.birthday, 89 | ); 90 | 91 | @override 92 | List get props => [sex, activityLevel, height, weight, birthday]; 93 | } 94 | -------------------------------------------------------------------------------- /lib/models/food.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/food_source.dart'; 2 | import 'package:equatable/equatable.dart'; 3 | 4 | /// A representation of a food item 5 | /// 6 | /// Note: all food nutrients are normalized to 100g! Use conversions to convert 7 | /// the values to other amounts 8 | class Food extends Equatable { 9 | final int sourceID; 10 | final String name; 11 | final FoodSource source; 12 | 13 | /// kCal / 100g 14 | final double energy; 15 | 16 | /// g / 100g 17 | final double fatTotal; 18 | 19 | /// g / 100g 20 | final double fatSaturated; 21 | 22 | /// g / 100g 23 | final double fatTransaturated; 24 | 25 | /// g / 100g 26 | final double fatPolyunsaturated; 27 | 28 | /// g / 100g 29 | final double fatMonounsaturated; 30 | 31 | /// mg / 100g 32 | final double cholesterol; 33 | 34 | /// mg / 100g 35 | final double sodium; 36 | 37 | /// g / 100g 38 | final double carbohydrates; 39 | 40 | /// g / 100g 41 | final double fiber; 42 | 43 | /// g / 100g 44 | final double sugars; 45 | 46 | /// g / 100g 47 | final double protein; 48 | 49 | /// mg / 100g 50 | final double calcium; 51 | 52 | /// mg / 100g 53 | final double potassium; 54 | 55 | /// mg / 100g 56 | final double iron; 57 | 58 | /// g / 100g 59 | final double alcohol; 60 | 61 | /// mg / 100g 62 | final double caffeine; 63 | 64 | const Food({ 65 | this.sourceID, 66 | this.name, 67 | this.source, 68 | this.energy, 69 | this.fatTotal, 70 | this.fatSaturated, 71 | this.fatPolyunsaturated, 72 | this.fatMonounsaturated, 73 | this.fatTransaturated, 74 | this.cholesterol, 75 | this.sodium, 76 | this.carbohydrates, 77 | this.fiber, 78 | this.sugars, 79 | this.protein, 80 | this.calcium, 81 | this.potassium, 82 | this.alcohol, 83 | this.iron, 84 | this.caffeine, 85 | }); 86 | 87 | Food.fromJson(Map json, FoodSource source) 88 | : name = json['name'], 89 | sourceID = json['id'], 90 | source = source, 91 | energy = json['energy'], 92 | fatTotal = json['fat_total'], 93 | fatSaturated = json['fat_saturated'], 94 | fatPolyunsaturated = json['fat_polyunsaturated'], 95 | fatMonounsaturated = json['fat_monounsaturated'], 96 | fatTransaturated = json['fat_transatured'], 97 | cholesterol = json['cholesterol'], 98 | sodium = json['sodium'], 99 | carbohydrates = json['carbohydrates'], 100 | fiber = json['fiber'], 101 | sugars = json['sugars'], 102 | protein = json['protein'], 103 | calcium = json['calcium'], 104 | potassium = json['potassium'], 105 | alcohol = json['alcohol'], 106 | iron = json['iron'], 107 | caffeine = json['caffeine']; 108 | 109 | @override 110 | List get props => [ 111 | name, 112 | energy, 113 | fatTotal, 114 | fatSaturated, 115 | fatPolyunsaturated, 116 | fatMonounsaturated, 117 | fatTransaturated, 118 | cholesterol, 119 | sodium, 120 | carbohydrates, 121 | fiber, 122 | sugars, 123 | protein, 124 | calcium, 125 | potassium, 126 | alcohol, 127 | iron, 128 | caffeine, 129 | ]; 130 | } 131 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Chubster 3 | 4 | 5 | A fully private calorie counter / food journal / health tracker that explicitely does not share your data. 6 | 7 | 8 | 9 | 10 | 11 | 12 | ## Motivation 13 | 14 | There are a glut of calorie trackers out there: MyFitnessPal, LoseIt, FatSecret, Lifesum, etc. By and large these apps 15 | work well—they are chock full of features, have large communities with very large food databases, etc. The problem I 16 | have with all of them is that they aren't that private—reading their privacy policies indicates that each of them will 17 | collect and share various data about you as they see fit. This is fine for a lot of folks, but I'd rather keep my 18 | data private, especially data related to my health. Ultimately, the point of _Chubster_ is to provide an easy-to-use 19 | app for tracking your nutrition, health, and fitness, without anybody else spying (inadvertantly or not) on what I'm 20 | doing. You may find this app superfluous, but that's fine—you don't have to use it. I'm developing this mainly for my 21 | own needs, and sharing it in case others find it useful as well. 22 | 23 | ### Privacy 24 | 25 | * Chubster doesn't upload information about you, period. 26 | * All data you enter will stay in the app 1 27 | * You can export all your data at any time as a `.csv` file 28 | * You can import all your data at any time from a `.csv` file (there is no other migration mechanism) 29 | * You can opt-in to download nutrition data from an online database 30 | * You can opt-in to upload nutrition data to an online database 31 | * You can opt-in to download recipes from an online database 32 | * You can opt-in to upload recipes to an online database 33 | * You can host your own online database and use that instead of the mainline _Chubster_ database 34 | 35 | 1 with the exception of when you explicitely request to share food nutrition data and/or recipes with the 36 | _Chubster_ server 37 | 38 | 39 | ## Features 40 | 41 | The following is a brainstormed list of features, which are currently a mix of _needs_ and _wants_. As the app 42 | progresses, this list will start to separate into either _needs_ or _wants_, which will drive the development and 43 | release schedule. 44 | 45 | - [ ] Record data about body metrics 46 | - [ ] Age 47 | - [ ] Sex 48 | - [ ] Height 49 | - [ ] Track body metrics over time 50 | - [ ] Self-configurable items, for example: weight, body composition, measurements, etc 51 | - [ ] Filter the data to smooth out day-to-day variations 52 | - [ ] Forecast metrics into the future 53 | - [ ] Record data about daily nutritional intake 54 | - [ ] Enter nutritional information about foods into a local database 55 | - [ ] Compose foods out of other foods (recipes) 56 | - [ ] Search foods from local database 57 | - [ ] Group foods into meals 58 | - [ ] Configure daily targets for nutrition metrics (calories, fats, proteins, carbs, etc) 59 | - [ ] Dashboard to quickly gauge daily progress to nutrition metrics 60 | - [ ] Synchronize foods with an online database 61 | - [ ] Import / export data 62 | - [ ] Export all data to a series of `.csv` files 63 | - [ ] Import all data from a series of `.csv` files 64 | 65 | ## Development 66 | 67 | The _Chubster_ app is developed in [Flutter](https://flutter.dev/), using the 68 | [BLoC](https://www.didierboelens.com/2018/08/reactive-programming---streams---bloc/) pattern. 69 | 70 | ## Licenses 71 | 72 | * Logo is `Pig by Hey Rabbit from the Noun Project`: https://thenounproject.com/search/?q=pig&i=2669846 73 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | generated_key_values = {} 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) do |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | generated_key_values[podname] = podpath 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | end 32 | generated_key_values 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | use_modular_headers! 38 | 39 | # Flutter Pod 40 | 41 | copied_flutter_dir = File.join(__dir__, 'Flutter') 42 | copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') 43 | copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') 44 | unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) 45 | # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. 46 | # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. 47 | # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. 48 | 49 | generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') 50 | unless File.exist?(generated_xcode_build_settings_path) 51 | raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" 52 | end 53 | generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) 54 | cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; 55 | 56 | unless File.exist?(copied_framework_path) 57 | FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) 58 | end 59 | unless File.exist?(copied_podspec_path) 60 | FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) 61 | end 62 | end 63 | 64 | # Keep pod path relative so it can be checked into Podfile.lock. 65 | pod 'Flutter', :path => 'Flutter' 66 | 67 | # Plugin Pods 68 | 69 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 70 | # referring to absolute paths on developers' machines. 71 | system('rm -rf .symlinks') 72 | system('mkdir -p .symlinks/plugins') 73 | plugin_pods = parse_KV_file('../.flutter-plugins') 74 | plugin_pods.each do |name, path| 75 | symlink = File.join('.symlinks', 'plugins', name) 76 | File.symlink(path, symlink) 77 | pod name, :path => File.join(symlink, 'ios') 78 | end 79 | end 80 | 81 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. 82 | install! 'cocoapods', :disable_input_output_paths => true 83 | 84 | post_install do |installer| 85 | installer.pods_project.targets.each do |target| 86 | target.build_configurations.each do |config| 87 | config.build_settings['ENABLE_BITCODE'] = 'NO' 88 | end 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /lib/data_providers/local_foods_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:chubster/models/food_conversion.dart'; 3 | import 'package:path/path.dart' as p; 4 | import 'package:chubster/data_providers/foods_provider.dart'; 5 | import 'package:chubster/models/food.dart'; 6 | import 'package:chubster/models/food_source.dart'; 7 | import 'package:sqflite/sqflite.dart'; 8 | 9 | class LocalFoodsProvider extends FoodsProvider { 10 | final Database _db; 11 | 12 | LocalFoodsProvider(this._db) : assert(_db != null); 13 | 14 | static void _onConfigure(Database db) async { 15 | await db.execute("PRAGMA foreign_keys = ON"); 16 | } 17 | 18 | static void _onCreate(Database db, int version) async { 19 | await db.execute(''' 20 | create table foods( 21 | id integer not null primary key autoincrement, 22 | name text not null, 23 | energy real default null, -- kCal / 100g 24 | fat_total real default null, -- g / 100g 25 | fat_saturated real default null, -- g / 100g 26 | fat_transaturated real default null, -- g / 100g 27 | fat_polyunsaturated real default null, -- g / 100g 28 | fat_monounsaturated real default null, -- g / 100g 29 | cholesterol real default null, -- mg / 100g 30 | sodium real default null, -- mg / 100g 31 | carbohydrates real default null, -- g / 100g 32 | fiber real default null, -- g / 100g 33 | sugars real default null, -- g / 100g 34 | protein real default null, -- g / 100g 35 | calcium real default null, -- mg / 100g 36 | potassium real default null, -- mg / 100g 37 | iron real default null, -- mg / 100g 38 | alcohol real default null, -- g / 100g 39 | caffeine real default null -- mg / 100g 40 | ) 41 | '''); 42 | await db.execute(''' 43 | create index food_name on foods(name) 44 | '''); 45 | await db.execute(''' 46 | create table measurements( 47 | id integer not null primary key autoincrement, 48 | description text not null 49 | ) 50 | '''); 51 | await db.execute(''' 52 | create table conversions( 53 | food_id integer not null, 54 | measurement_id integer not null, 55 | conversion_factor real not null, 56 | unique(food_id, measurement_id), 57 | foreign key(food_id) references foods(id), 58 | foreign key(measurement_id) references measurements(id) 59 | ) 60 | '''); 61 | await db.execute(''' 62 | create index conversions_food_id on conversions(food_id) 63 | '''); 64 | } 65 | 66 | static Future open() async { 67 | // get a path to the database file 68 | var databasesPath = await getDatabasesPath(); 69 | var path = p.join(databasesPath, 'foods.user.db'); 70 | await Directory(databasesPath).create(recursive: true); 71 | 72 | // open the database 73 | Database db = await openDatabase(path, 74 | onConfigure: _onConfigure, onCreate: _onCreate, version: 1); 75 | LocalFoodsProvider repo = LocalFoodsProvider(db); 76 | 77 | print("Compile options:"); 78 | List compileOptions = await db.rawQuery("pragma compile_options"); 79 | print(compileOptions.toString()); 80 | for(Map compileOption in compileOptions) { 81 | print(compileOption['compile_options']); 82 | } 83 | print(" compile options"); 84 | 85 | return repo; 86 | } 87 | 88 | @override 89 | Future> searchForFoodByName(String name) async { 90 | List results = await _db 91 | .rawQuery('select * from foods where name like ?', ['%$name%']); 92 | List foods = 93 | results.map((food) => Food.fromJson(food, FoodSource.local)).toList(); 94 | return foods; 95 | } 96 | 97 | Future createFood(Food food) async { 98 | // TODO: implement createFood 99 | throw Exception("createFood is not implemented yet!"); 100 | } 101 | 102 | @override 103 | Future> getConversionsForFood(int sourceID) async { 104 | // TODO: local conversions 105 | return List(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /lib/screens/foods/foods_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/blocs/settings/settings_bloc.dart'; 2 | import 'package:chubster/repositories/foods_repository.dart'; 3 | import 'package:chubster/repositories/settings_repository.dart'; 4 | import 'package:chubster/screens/foods/food_details/food_details_screen.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_bloc/flutter_bloc.dart'; 7 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 8 | import 'package:just_debounce_it/just_debounce_it.dart'; 9 | import 'package:loading_indicator/loading_indicator.dart'; 10 | import 'bloc/bloc.dart'; 11 | 12 | class FoodsScreen extends StatelessWidget { 13 | @override 14 | Widget build(BuildContext context) { 15 | final FoodsRepository foods = 16 | RepositoryProvider.of(context); 17 | assert(foods != null); 18 | final SettingsRepository settings = 19 | RepositoryProvider.of(context); 20 | assert(settings != null); 21 | 22 | return BlocProvider( 23 | create: (_) => FoodsBloc(foods), 24 | child: Container( 25 | child: Column( 26 | children: [ 27 | _SearchResults(), 28 | _SearchBar(), 29 | ], 30 | ) 31 | ) 32 | ); 33 | } 34 | } 35 | 36 | class _SearchBar extends StatefulWidget { 37 | _SearchBar({Key key}) : super(key: key); 38 | 39 | @override 40 | _SearchBarState createState() => _SearchBarState(); 41 | } 42 | 43 | class _SearchBarState extends State<_SearchBar> { 44 | TextEditingController _textController; 45 | 46 | @override 47 | void initState() { 48 | super.initState(); 49 | _textController = TextEditingController(text: ""); 50 | } 51 | 52 | void _updateSearch(FoodsBloc foodsBloc, SettingsBloc settingsBloc, String searchTerm) { 53 | foodsBloc.add(SearchTermChangedEvent(searchTerm, settingsBloc.state.localActive, settingsBloc.state.cnfActive)); 54 | } 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | final FoodsBloc foodsBloc = BlocProvider.of(context); 59 | assert(foodsBloc != null); 60 | final SettingsBloc settingsBloc = BlocProvider.of(context); 61 | assert(settingsBloc != null); 62 | String label; 63 | if(foodsBloc.state is EmptyFoodsState) { 64 | label = "Search for foods by name"; 65 | } 66 | String error; 67 | if(foodsBloc.state is SearchingFoodsError) { 68 | error = "Error searching databases!"; 69 | } 70 | 71 | return Container( 72 | color: Theme.of(context).dialogBackgroundColor, 73 | child: 74 | Padding( 75 | padding: EdgeInsets.fromLTRB(16, 8, 16, 16), 76 | child: TextField( 77 | autofocus: true, 78 | autocorrect: true, 79 | decoration: InputDecoration( 80 | icon: Icon(FontAwesomeIcons.search), 81 | hintText: label, 82 | errorText: error, 83 | ), 84 | controller: _textController, 85 | onChanged: (searchTerm) => 86 | Debounce.milliseconds(100, _updateSearch, [foodsBloc, settingsBloc, searchTerm]), 87 | onSubmitted: (searchTerm) => 88 | Debounce.runAndClear(_updateSearch, [foodsBloc, settingsBloc, searchTerm]), 89 | ), 90 | ), 91 | ); 92 | } 93 | } 94 | 95 | class _SearchResults extends StatelessWidget { 96 | const _SearchResults({Key key}) : super(key: key); 97 | 98 | @override 99 | Widget build(BuildContext context) { 100 | return BlocBuilder( 101 | builder: (context, state) { 102 | if (state is SearchingFoodsState) { 103 | return Center( 104 | child: SizedBox( 105 | width: 30.0, 106 | height: 30.0, 107 | child: LoadingIndicator( 108 | indicatorType: Indicator.pacman, 109 | ))); 110 | } else if (state is SearchResultsFoodsState) { 111 | return Expanded( 112 | child: ListView( 113 | padding: EdgeInsets.all(10.0), 114 | children: state.foods.map((food) { 115 | return ListTile( 116 | title: Text(food.name), 117 | onTap: () => Navigator.of(context).push(MaterialPageRoute( 118 | builder: (context) => FoodDetailsScreen( 119 | food: food, 120 | ), 121 | )), 122 | ); 123 | }).toList(), 124 | ), 125 | ); 126 | } else { 127 | return Expanded( 128 | child: Container() 129 | ); 130 | } 131 | }, 132 | ); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/blocs/profile/bloc.dart'; 2 | import 'package:chubster/blocs/settings/settings_bloc.dart'; 3 | import 'package:chubster/blocs/settings/settings_event.dart'; 4 | import 'package:chubster/repositories/foods_repository.dart'; 5 | import 'package:chubster/repositories/profile_repository.dart'; 6 | import 'package:chubster/repositories/settings_repository.dart'; 7 | import 'package:chubster/screens/foods/foods_screen.dart'; 8 | import 'package:chubster/screens/profile/profile_screen.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_bloc/flutter_bloc.dart'; 11 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 12 | import 'blocs/theme/bloc.dart'; 13 | import 'screens/dashboard/dashboard_screen.dart'; 14 | 15 | void main() async { 16 | //BlocSupervisor.delegate = LogBlocDelegate(); 17 | WidgetsFlutterBinding.ensureInitialized(); 18 | final FoodsRepository foods = await FoodsRepository.open(); 19 | final SettingsRepository settings = await SettingsRepository.load(); 20 | final ProfileRepository profile = await ProfileRepository.open(); 21 | 22 | assert(foods != null); 23 | assert(settings != null); 24 | assert(profile != null); 25 | 26 | runApp(MultiBlocProvider( 27 | providers: [ 28 | BlocProvider( 29 | create: (_) => ThemeBloc(), 30 | ), 31 | BlocProvider( 32 | create: (_) => SettingsBloc(settings), 33 | ), 34 | BlocProvider( 35 | create: (_) => ProfileBloc(profile), 36 | ), 37 | ], 38 | child: BlocBuilder( 39 | builder: (context, state) => 40 | _ChubsterApp(foods: foods, settings: settings, profile: profile), 41 | ), 42 | )); 43 | } 44 | 45 | /// Chubster app is stateful so it can listen to platform brightness changes 46 | /// using `WidgetsBindingObserver` 47 | class _ChubsterApp extends StatefulWidget { 48 | final FoodsRepository foods; 49 | final ProfileRepository profile; 50 | final SettingsRepository settings; 51 | const _ChubsterApp({Key key, @required this.foods, @required this.settings, this.profile}) 52 | : assert(foods != null), 53 | assert(settings != null), 54 | assert(profile != null), 55 | super(key: key); 56 | 57 | @override 58 | State createState() => _ChubsterAppState(); 59 | } 60 | 61 | enum Screen { dashboard, stats, log, foods, profile } 62 | 63 | class _ChubsterAppState extends State<_ChubsterApp> 64 | with WidgetsBindingObserver { 65 | Screen _currentScreen; 66 | 67 | @override 68 | void initState() { 69 | super.initState(); 70 | WidgetsBinding.instance.addObserver(this); 71 | _currentScreen = Screen.dashboard; 72 | BlocProvider.of(context).add(LoadSettingsFromRepository()); 73 | BlocProvider.of(context).add(LoadProfileFromRepository()); 74 | } 75 | 76 | @override 77 | void dispose() { 78 | WidgetsBinding.instance.removeObserver(this); 79 | super.dispose(); 80 | } 81 | 82 | @override 83 | void didChangePlatformBrightness() { 84 | final Brightness brightness = 85 | WidgetsBinding.instance.window.platformBrightness; 86 | BlocProvider.of(context) 87 | .add(BrightnessChanged(brightness: brightness)); 88 | } 89 | 90 | @override 91 | Widget build(BuildContext context) { 92 | Widget body; 93 | switch(_currentScreen) { 94 | case Screen.dashboard: 95 | body = DashboardScreen(); 96 | break; 97 | case Screen.stats: 98 | body = Container(); 99 | break; 100 | case Screen.log: 101 | body = Container(); 102 | break; 103 | case Screen.foods: 104 | body = FoodsScreen(); 105 | break; 106 | case Screen.profile: 107 | body = ProfileScreen(); 108 | break; 109 | } 110 | 111 | return MultiRepositoryProvider( 112 | providers: [ 113 | RepositoryProvider.value(value: widget.foods), 114 | RepositoryProvider.value(value: widget.settings), 115 | RepositoryProvider.value(value: widget.profile), 116 | ], 117 | child: MaterialApp( 118 | title: 'Chubster', 119 | theme: BlocProvider.of(context).state.theme, 120 | home: Scaffold( 121 | body: Padding( 122 | padding: EdgeInsets.only(top: 4.0), 123 | child: body, 124 | ), 125 | bottomNavigationBar: BottomNavigationBar( 126 | currentIndex: _currentScreen.index, 127 | type: BottomNavigationBarType.shifting, 128 | items: [ 129 | BottomNavigationBarItem(icon: Icon(FontAwesomeIcons.home), title: Text("Dashboard"), backgroundColor: BlocProvider.of(context).state.theme.accentColor), 130 | BottomNavigationBarItem(icon: Icon(FontAwesomeIcons.chartLine), title: Text("Stats"), backgroundColor: BlocProvider.of(context).state.theme.accentColor), 131 | BottomNavigationBarItem(icon: Icon(FontAwesomeIcons.cookieBite), title: Text("Log"), backgroundColor: BlocProvider.of(context).state.theme.accentColor), 132 | BottomNavigationBarItem(icon: Icon(FontAwesomeIcons.carrot), title: Text("Foods"), backgroundColor: BlocProvider.of(context).state.theme.accentColor), 133 | BottomNavigationBarItem(icon: Icon(FontAwesomeIcons.userAstronaut), title: Text("Profile"), backgroundColor: BlocProvider.of(context).state.theme.accentColor), 134 | ], 135 | onTap: (index) => setState(() { 136 | _currentScreen = Screen.values[index]; 137 | }) 138 | ), 139 | ), 140 | ) 141 | ); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /lib/data_providers/profile_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:chubster/models/measurement.dart'; 3 | import 'package:chubster/models/units.dart'; 4 | import 'package:chubster/models/weight_measurement.dart'; 5 | import 'package:path/path.dart' as p; 6 | import 'package:chubster/models/food.dart'; 7 | import 'package:sqflite/sqflite.dart'; 8 | 9 | class ProfileProvider { 10 | final Database _db; 11 | 12 | ProfileProvider(this._db) : assert(_db != null); 13 | 14 | Future recordFood(Food food, double amountInGrams, String meal) async { 15 | // convert all values based on the amount 16 | double energy = food.energy == null ? null : (food.energy * 100.0 / amountInGrams); 17 | double fatTotal = food.fatTotal == null ? null : (food.fatTotal * 100.0 / amountInGrams); 18 | double fatSaturated = food.fatSaturated == null ? null : (food.fatSaturated * 100.0 / amountInGrams); 19 | double fatTransaturated = food.fatTransaturated == null ? null : (food.fatTransaturated * 100.0 / amountInGrams); 20 | double fatPolyunsaturated = food.fatPolyunsaturated == null ? null : (food.fatPolyunsaturated * 100.0 / amountInGrams); 21 | double fatMonounsaturated = food.fatMonounsaturated == null ? null : (food.fatMonounsaturated * 100.0 / amountInGrams); 22 | double cholesterol = food.cholesterol == null ? null : (food.cholesterol * 100.0 / amountInGrams); 23 | double sodium = food.sodium == null ? null : (food.sodium * 100.0 / amountInGrams); 24 | double carbohydrates = food.carbohydrates == null ? null : (food.carbohydrates * 100.0 / amountInGrams); 25 | double fiber = food.fiber == null ? null : (food.fiber * 100.0 / amountInGrams); 26 | double sugars = food.sugars == null ? null : (food.sugars * 100.0 / amountInGrams); 27 | double protein = food.protein == null ? null : (food.protein * 100.0 / amountInGrams); 28 | double calcium = food.calcium == null ? null : (food.calcium * 100.0 / amountInGrams); 29 | double potassium = food.potassium == null ? null : (food.potassium * 100.0 / amountInGrams); 30 | double iron = food.iron == null ? null : (food.iron * 100.0 / amountInGrams); 31 | double alcohol = food.alcohol == null ? null : (food.alcohol * 100.0 / amountInGrams); 32 | double caffeine = food.caffeine == null ? null : (food.caffeine * 100.0 / amountInGrams); 33 | 34 | await _db.rawInsert(''' 35 | insert into diet(name, meal, foods_source, foods_source_id, amount, energy, fat_total, fat_saturated, fat_transaturated, fat_polyunsaturated, fat_monounsaturated, cholesterol, sodium, carbohydrates, fiber, sugars, protein, calcium, potassium, iron, alcohol, caffeine) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 36 | ''', [ 37 | food.name, meal, food.source.toString(), food.sourceID, amountInGrams, energy, fatTotal, fatSaturated, fatTransaturated, fatPolyunsaturated, fatMonounsaturated, cholesterol, sodium, carbohydrates, fiber, sugars, protein, calcium, potassium, iron, alcohol, caffeine, 38 | ]); 39 | } 40 | 41 | Future recordWeight(WeightUnits weight) async { 42 | double weightInKg = weight.toKiloGrams().value; 43 | await _db.rawInsert("insert into weights(value) values(?)", [weightInKg]); 44 | } 45 | 46 | Future getLatestWeight() async { 47 | List> rows = await _db.rawQuery("select value, strftime('%s',timestamp) as timestamp from weights order by timestamp desc limit 1"); 48 | if(rows == null || rows.length == 0) return null; 49 | double value = rows[0]['value']; 50 | String ts = rows[0]['timestamp']; 51 | int time = int.parse(ts); 52 | DateTime timestamp = DateTime.fromMillisecondsSinceEpoch(time * 1000, isUtc: true); 53 | return WeightMeasurement( 54 | weight: KiloGrams(value), 55 | timestamp: timestamp, 56 | ); 57 | } 58 | 59 | Future> getWeights({DateTime start, DateTime end}) async { 60 | throw Exception("Not implemented yet"); 61 | } 62 | 63 | Future recordLengthMeasurement(String measurement, LengthUnits length) async { 64 | double lengthInCM = length.toCentiMeters().value; 65 | await _db.rawInsert("insert into measurements(measurement, value) values(?, ?)", [measurement, lengthInCM]); 66 | } 67 | 68 | Future getLatestMeasurement(String name) async { 69 | throw Exception("Not implemented yet"); 70 | } 71 | 72 | Future> getMeasurements(String nane, {DateTime start, DateTime end}) async { 73 | throw Exception("Not implemented yet"); 74 | } 75 | 76 | static void _onConfigure(Database db) async { 77 | await db.execute("PRAGMA foreign_keys = ON"); 78 | } 79 | 80 | static void _onCreate(Database db, int version) async { 81 | await db.execute(''' 82 | create table diet( 83 | timestamp text not null default current_timestamp, -- when the food was consumed 84 | name text not null, -- the name of the food that was consumed 85 | meal text default null, -- an optional meal to associate the food with 86 | foods_source text not null, -- the textual representation of the food source database 87 | foods_source_id integer not null, -- the primary key of the food in the given food source database 88 | amount real default null, -- g (the number of grams that we consumed, all nutrient values are raw totals, pre-adjusted using this amount) 89 | energy real default null, -- kCal 90 | fat_total real default null, -- g 91 | fat_saturated real default null, -- g 92 | fat_transaturated real default null, -- g 93 | fat_polyunsaturated real default null, -- g 94 | fat_monounsaturated real default null, -- g 95 | cholesterol real default null, -- mg 96 | sodium real default null, -- mg 97 | carbohydrates real default null, -- g 98 | fiber real default null, -- g 99 | sugars real default null, -- g 100 | protein real default null, -- g 101 | calcium real default null, -- mg 102 | potassium real default null, -- mg 103 | iron real default null, -- mg 104 | alcohol real default null, -- g 105 | caffeine real default null -- mg 106 | ) 107 | '''); 108 | await db.execute(''' 109 | create index diet_times on diet(timestamp) 110 | '''); 111 | await db.execute(''' 112 | create table weights( 113 | value real not null, 114 | timestamp text not null default current_timestamp 115 | ) 116 | '''); 117 | await db.execute(''' 118 | create index weights_timestamp on weights(timestamp) 119 | '''); 120 | await db.execute(''' 121 | create table measurements( 122 | measurement text not null, 123 | value real not null, 124 | timestamp text not null default current_timestamp 125 | ) 126 | '''); 127 | await db.execute(''' 128 | create index measurements_measurement on measurements(measurement) 129 | '''); 130 | await db.execute(''' 131 | create index measurements_measurement_timestamp on measurements(measurement, timestamp) 132 | '''); 133 | } 134 | 135 | static Future open() async { 136 | // get a path to the database file 137 | var databasesPath = await getDatabasesPath(); 138 | var path = p.join(databasesPath, 'profile.db'); 139 | await Directory(databasesPath).create(recursive: true); 140 | 141 | // open the database 142 | Database db = await openDatabase(path, 143 | onConfigure: _onConfigure, onCreate: _onCreate, version: 1); 144 | ProfileProvider repo = ProfileProvider(db); 145 | 146 | return repo; 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /working_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 27 | image/svg+xml 28 | 30 | 31 | 32 | 33 | 34 | 36 | 56 | 60 | 67 | 71 | 76 | 81 | 87 | 93 | 99 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.11" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.0" 25 | bloc: 26 | dependency: transitive 27 | description: 28 | name: bloc 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "3.0.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.0.5" 39 | charcode: 40 | dependency: transitive 41 | description: 42 | name: charcode 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.2" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.14.11" 53 | convert: 54 | dependency: transitive 55 | description: 56 | name: convert 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.1" 60 | crypto: 61 | dependency: transitive 62 | description: 63 | name: crypto 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "2.1.3" 67 | equatable: 68 | dependency: "direct main" 69 | description: 70 | name: equatable 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.0.2" 74 | fancy_bottom_navigation: 75 | dependency: "direct main" 76 | description: 77 | name: fancy_bottom_navigation 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "0.3.2" 81 | flutter: 82 | dependency: "direct main" 83 | description: flutter 84 | source: sdk 85 | version: "0.0.0" 86 | flutter_bloc: 87 | dependency: "direct main" 88 | description: 89 | name: flutter_bloc 90 | url: "https://pub.dartlang.org" 91 | source: hosted 92 | version: "3.1.0" 93 | flutter_launcher_icons: 94 | dependency: "direct dev" 95 | description: 96 | name: flutter_launcher_icons 97 | url: "https://pub.dartlang.org" 98 | source: hosted 99 | version: "0.7.4" 100 | flutter_scale: 101 | dependency: "direct main" 102 | description: 103 | name: flutter_scale 104 | url: "https://pub.dartlang.org" 105 | source: hosted 106 | version: "0.1.2" 107 | flutter_test: 108 | dependency: "direct dev" 109 | description: flutter 110 | source: sdk 111 | version: "0.0.0" 112 | flutter_web_plugins: 113 | dependency: transitive 114 | description: flutter 115 | source: sdk 116 | version: "0.0.0" 117 | font_awesome_flutter: 118 | dependency: "direct main" 119 | description: 120 | name: font_awesome_flutter 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "8.5.0" 124 | image: 125 | dependency: transitive 126 | description: 127 | name: image 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "2.1.4" 131 | intl: 132 | dependency: "direct main" 133 | description: 134 | name: intl 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "0.16.1" 138 | just_debounce_it: 139 | dependency: "direct main" 140 | description: 141 | name: just_debounce_it 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "3.0.0+2" 145 | loading_indicator: 146 | dependency: "direct main" 147 | description: 148 | name: loading_indicator 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.1.0" 152 | matcher: 153 | dependency: transitive 154 | description: 155 | name: matcher 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "0.12.6" 159 | meta: 160 | dependency: transitive 161 | description: 162 | name: meta 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.1.8" 166 | nested: 167 | dependency: transitive 168 | description: 169 | name: nested 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "0.0.4" 173 | path: 174 | dependency: transitive 175 | description: 176 | name: path 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.6.4" 180 | pedantic: 181 | dependency: transitive 182 | description: 183 | name: pedantic 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "1.8.0+1" 187 | petitparser: 188 | dependency: transitive 189 | description: 190 | name: petitparser 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "2.4.0" 194 | plugin_platform_interface: 195 | dependency: transitive 196 | description: 197 | name: plugin_platform_interface 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "1.0.1" 201 | provider: 202 | dependency: transitive 203 | description: 204 | name: provider 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "4.0.1" 208 | quiver: 209 | dependency: transitive 210 | description: 211 | name: quiver 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "2.0.5" 215 | rxdart: 216 | dependency: transitive 217 | description: 218 | name: rxdart 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "0.23.1" 222 | shared_preferences: 223 | dependency: "direct main" 224 | description: 225 | name: shared_preferences 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "0.5.6" 229 | shared_preferences_macos: 230 | dependency: transitive 231 | description: 232 | name: shared_preferences_macos 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "0.0.1+3" 236 | shared_preferences_platform_interface: 237 | dependency: transitive 238 | description: 239 | name: shared_preferences_platform_interface 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "1.0.1" 243 | shared_preferences_web: 244 | dependency: transitive 245 | description: 246 | name: shared_preferences_web 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "0.1.2+2" 250 | sky_engine: 251 | dependency: transitive 252 | description: flutter 253 | source: sdk 254 | version: "0.0.99" 255 | source_span: 256 | dependency: transitive 257 | description: 258 | name: source_span 259 | url: "https://pub.dartlang.org" 260 | source: hosted 261 | version: "1.5.5" 262 | sqflite: 263 | dependency: "direct main" 264 | description: 265 | name: sqflite 266 | url: "https://pub.dartlang.org" 267 | source: hosted 268 | version: "1.2.0" 269 | stack_trace: 270 | dependency: transitive 271 | description: 272 | name: stack_trace 273 | url: "https://pub.dartlang.org" 274 | source: hosted 275 | version: "1.9.3" 276 | stream_channel: 277 | dependency: transitive 278 | description: 279 | name: stream_channel 280 | url: "https://pub.dartlang.org" 281 | source: hosted 282 | version: "2.0.0" 283 | string_scanner: 284 | dependency: transitive 285 | description: 286 | name: string_scanner 287 | url: "https://pub.dartlang.org" 288 | source: hosted 289 | version: "1.0.5" 290 | synchronized: 291 | dependency: transitive 292 | description: 293 | name: synchronized 294 | url: "https://pub.dartlang.org" 295 | source: hosted 296 | version: "2.1.1" 297 | term_glyph: 298 | dependency: transitive 299 | description: 300 | name: term_glyph 301 | url: "https://pub.dartlang.org" 302 | source: hosted 303 | version: "1.1.0" 304 | test_api: 305 | dependency: transitive 306 | description: 307 | name: test_api 308 | url: "https://pub.dartlang.org" 309 | source: hosted 310 | version: "0.2.11" 311 | typed_data: 312 | dependency: transitive 313 | description: 314 | name: typed_data 315 | url: "https://pub.dartlang.org" 316 | source: hosted 317 | version: "1.1.6" 318 | url_launcher: 319 | dependency: "direct main" 320 | description: 321 | name: url_launcher 322 | url: "https://pub.dartlang.org" 323 | source: hosted 324 | version: "5.4.1" 325 | url_launcher_macos: 326 | dependency: transitive 327 | description: 328 | name: url_launcher_macos 329 | url: "https://pub.dartlang.org" 330 | source: hosted 331 | version: "0.0.1+2" 332 | url_launcher_platform_interface: 333 | dependency: transitive 334 | description: 335 | name: url_launcher_platform_interface 336 | url: "https://pub.dartlang.org" 337 | source: hosted 338 | version: "1.0.5" 339 | url_launcher_web: 340 | dependency: transitive 341 | description: 342 | name: url_launcher_web 343 | url: "https://pub.dartlang.org" 344 | source: hosted 345 | version: "0.1.0+2" 346 | vector_math: 347 | dependency: transitive 348 | description: 349 | name: vector_math 350 | url: "https://pub.dartlang.org" 351 | source: hosted 352 | version: "2.0.8" 353 | xml: 354 | dependency: transitive 355 | description: 356 | name: xml 357 | url: "https://pub.dartlang.org" 358 | source: hosted 359 | version: "3.5.0" 360 | yaml: 361 | dependency: transitive 362 | description: 363 | name: yaml 364 | url: "https://pub.dartlang.org" 365 | source: hosted 366 | version: "2.2.0" 367 | sdks: 368 | dart: ">=2.6.0 <3.0.0" 369 | flutter: ">=1.12.13+hotfix.4 <2.0.0" 370 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Kenton Hamaluik 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /lib/screens/foods/food_details/food_details_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/blocs/profile/bloc.dart'; 2 | import 'package:chubster/models/food.dart'; 3 | import 'package:chubster/models/activity_level.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | 7 | class FoodDetailsScreen extends StatelessWidget { 8 | final Food food; 9 | const FoodDetailsScreen({Key key, this.food}) : assert(food != null), super(key: key); 10 | 11 | static String renderDailyValue(double value, double multiplier, double reference) { 12 | if(value == null || reference == null || reference == 0.0) return ""; 13 | return (100.0 * multiplier * value / reference).toStringAsFixed(0) + " %"; 14 | } 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | final ProfileBloc profile = BlocProvider.of(context); 19 | assert(profile != null); 20 | double tdee = profile.state.totalDailyEnergy ?? 2000.0; 21 | double multiplier = tdee / 2000.0; 22 | 23 | return Scaffold( 24 | appBar: AppBar(title: Text(food.name)), 25 | body: Padding( 26 | padding: EdgeInsets.all(16.0), 27 | child: ListView( 28 | children: [ 29 | Text(food.name, style: Theme.of(context).textTheme.title), 30 | Text("Energy: ${food.energy ?? '?'} kCal", style: Theme.of(context).textTheme.subtitle), 31 | Row( 32 | mainAxisAlignment: MainAxisAlignment.end, 33 | children: [ 34 | Expanded(flex: 3, child: Container()), 35 | Expanded( 36 | flex: 1, 37 | child: Text("/ 100 g", textAlign: TextAlign.right,) 38 | ), 39 | Expanded( 40 | flex: 1, 41 | child: Text("% Daily", textAlign: TextAlign.right,), 42 | ) 43 | ], 44 | ), 45 | Divider(thickness: 4.0, color: Theme.of(context).textTheme.body1.color), 46 | Row( 47 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 48 | children: [ 49 | Expanded( 50 | flex: 3, 51 | child: Text("Total Fat", style: TextStyle(fontWeight: FontWeight.w700)), 52 | ), 53 | Expanded( 54 | flex: 1, 55 | child: Text("${food.fatTotal ?? '?'} g", style: TextStyle(fontWeight: FontWeight.w700), textAlign: TextAlign.right,), 56 | ), 57 | Expanded( 58 | flex: 1, 59 | child: Text(renderDailyValue(food.fatTotal, multiplier, 65), style: TextStyle(fontWeight: FontWeight.w700), textAlign: TextAlign.right,), 60 | ), 61 | ], 62 | ), 63 | Row( 64 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 65 | children: [ 66 | Expanded( 67 | flex: 3, 68 | child: Padding( 69 | padding: EdgeInsets.only(left: 16.0), 70 | child: Text("Monounsaturated"), 71 | ), 72 | ), 73 | Expanded( 74 | flex: 1, 75 | child: Text("${food.fatMonounsaturated?.toStringAsFixed(1) ?? '?'} g", textAlign: TextAlign.right,), 76 | ), 77 | Expanded( 78 | flex: 1, 79 | child: Text(renderDailyValue(food.fatMonounsaturated, multiplier, null), textAlign: TextAlign.right,), 80 | ), 81 | ], 82 | ), 83 | Row( 84 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 85 | children: [ 86 | Expanded( 87 | flex: 3, 88 | child: Padding( 89 | padding: EdgeInsets.only(left: 16.0), 90 | child: Text("Polyunsaturated"), 91 | ), 92 | ), 93 | Expanded( 94 | flex: 1, 95 | child: Text("${food.fatPolyunsaturated?.toStringAsFixed(1) ?? '?'} g", textAlign: TextAlign.right,), 96 | ), 97 | Expanded( 98 | flex: 1, 99 | child: Text(renderDailyValue(food.fatPolyunsaturated, multiplier, null), textAlign: TextAlign.right,), 100 | ), 101 | ], 102 | ), 103 | Row( 104 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 105 | children: [ 106 | Expanded( 107 | flex: 3, 108 | child: Padding( 109 | padding: EdgeInsets.only(left: 16.0), 110 | child: Text("Saturated"), 111 | ), 112 | ), 113 | Expanded( 114 | flex: 1, 115 | child: Text("${food.fatSaturated?.toStringAsFixed(1) ?? '?'} g", textAlign: TextAlign.right,), 116 | ), 117 | Expanded( 118 | flex: 1, 119 | child: Text(renderDailyValue(food.fatSaturated, multiplier, null), textAlign: TextAlign.right,), 120 | ), 121 | ], 122 | ), 123 | Row( 124 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 125 | children: [ 126 | Expanded( 127 | flex: 3, 128 | child: Padding( 129 | padding: EdgeInsets.only(left: 16.0), 130 | child: Text("Transaturated"), 131 | ), 132 | ), 133 | Expanded( 134 | flex: 1, 135 | child: Text("${food.fatTransaturated?.toStringAsFixed(1) ?? '?'} g", textAlign: TextAlign.right,), 136 | ), 137 | Expanded( 138 | flex: 1, 139 | child: Text(renderDailyValue(food.fatTransaturated, multiplier, null), textAlign: TextAlign.right,), 140 | ), 141 | ], 142 | ), 143 | Divider(thickness: 1.0, color: Theme.of(context).textTheme.body1.color), 144 | Row( 145 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 146 | children: [ 147 | Expanded( 148 | flex: 3, 149 | child: Text("Carbohydrate", style: TextStyle(fontWeight: FontWeight.w700)), 150 | ), 151 | Expanded( 152 | flex: 1, 153 | child: Text("${food.carbohydrates ?? '?'} g", style: TextStyle(fontWeight: FontWeight.w700), textAlign: TextAlign.right,), 154 | ), 155 | Expanded( 156 | flex: 1, 157 | child: Text(renderDailyValue(food.carbohydrates, multiplier, 65), style: TextStyle(fontWeight: FontWeight.w700), textAlign: TextAlign.right,), 158 | ), 159 | ], 160 | ), 161 | Row( 162 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 163 | children: [ 164 | Expanded( 165 | flex: 3, 166 | child: Padding( 167 | padding: EdgeInsets.only(left: 16.0), 168 | child: Text("Fibre"), 169 | ), 170 | ), 171 | Expanded( 172 | flex: 1, 173 | child: Text("${food.fiber?.toStringAsFixed(1) ?? '?'} g", textAlign: TextAlign.right,), 174 | ), 175 | Expanded( 176 | flex: 1, 177 | child: Text(renderDailyValue(food.fiber, multiplier, null), textAlign: TextAlign.right,), 178 | ), 179 | ], 180 | ), 181 | Row( 182 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 183 | children: [ 184 | Expanded( 185 | flex: 3, 186 | child: Padding( 187 | padding: EdgeInsets.only(left: 16.0), 188 | child: Text("Sugars"), 189 | ), 190 | ), 191 | Expanded( 192 | flex: 1, 193 | child: Text("${food.sugars?.toStringAsFixed(1) ?? '?'} g", textAlign: TextAlign.right,), 194 | ), 195 | Expanded( 196 | flex: 1, 197 | child: Text(renderDailyValue(food.sugars, multiplier, null), textAlign: TextAlign.right,), 198 | ), 199 | ], 200 | ), 201 | Divider(thickness: 1.0, color: Theme.of(context).textTheme.body1.color), 202 | Row( 203 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 204 | children: [ 205 | Expanded( 206 | flex: 3, 207 | child: Text("Protein", style: TextStyle(fontWeight: FontWeight.w700)), 208 | ), 209 | Expanded( 210 | flex: 1, 211 | child: Text("${food.protein ?? '?'} g", style: TextStyle(fontWeight: FontWeight.w700), textAlign: TextAlign.right,), 212 | ), 213 | Expanded( 214 | flex: 1, 215 | child: Text(renderDailyValue(food.protein, multiplier, 65), style: TextStyle(fontWeight: FontWeight.w700), textAlign: TextAlign.right,), 216 | ), 217 | ], 218 | ), 219 | Divider(thickness: 2.0, color: Theme.of(context).textTheme.body1.color), 220 | Row( 221 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 222 | children: [ 223 | Expanded( 224 | flex: 3, 225 | child: Padding( 226 | padding: EdgeInsets.only(left: 16.0), 227 | child: Text("Cholesterol"), 228 | ), 229 | ), 230 | Expanded( 231 | flex: 1, 232 | child: Text("${food.cholesterol?.toStringAsFixed(1) ?? '?'} mg", textAlign: TextAlign.right,), 233 | ), 234 | Expanded( 235 | flex: 1, 236 | child: Text(renderDailyValue(food.cholesterol, multiplier, null), textAlign: TextAlign.right,), 237 | ), 238 | ], 239 | ), 240 | Row( 241 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 242 | children: [ 243 | Expanded( 244 | flex: 3, 245 | child: Padding( 246 | padding: EdgeInsets.only(left: 16.0), 247 | child: Text("Sodium"), 248 | ), 249 | ), 250 | Expanded( 251 | flex: 1, 252 | child: Text("${food.sodium?.toStringAsFixed(1) ?? '?'} mg", textAlign: TextAlign.right,), 253 | ), 254 | Expanded( 255 | flex: 1, 256 | child: Text(renderDailyValue(food.sodium, multiplier, null), textAlign: TextAlign.right,), 257 | ), 258 | ], 259 | ), 260 | Row( 261 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 262 | children: [ 263 | Expanded( 264 | flex: 3, 265 | child: Padding( 266 | padding: EdgeInsets.only(left: 16.0), 267 | child: Text("Potassium"), 268 | ), 269 | ), 270 | Expanded( 271 | flex: 1, 272 | child: Text("${food.potassium?.toStringAsFixed(1) ?? '?'} mg", textAlign: TextAlign.right,), 273 | ), 274 | Expanded( 275 | flex: 1, 276 | child: Text(renderDailyValue(food.potassium, multiplier, null), textAlign: TextAlign.right,), 277 | ), 278 | ], 279 | ), 280 | Row( 281 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 282 | children: [ 283 | Expanded( 284 | flex: 3, 285 | child: Padding( 286 | padding: EdgeInsets.only(left: 16.0), 287 | child: Text("Calcium"), 288 | ), 289 | ), 290 | Expanded( 291 | flex: 1, 292 | child: Text("${food.calcium?.toStringAsFixed(1) ?? '?'} mg", textAlign: TextAlign.right,), 293 | ), 294 | Expanded( 295 | flex: 1, 296 | child: Text(renderDailyValue(food.calcium, multiplier, null), textAlign: TextAlign.right,), 297 | ), 298 | ], 299 | ), 300 | Row( 301 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 302 | children: [ 303 | Expanded( 304 | flex: 3, 305 | child: Padding( 306 | padding: EdgeInsets.only(left: 16.0), 307 | child: Text("Iron"), 308 | ), 309 | ), 310 | Expanded( 311 | flex: 1, 312 | child: Text("${food.iron?.toStringAsFixed(1) ?? '?'} mg", textAlign: TextAlign.right,), 313 | ), 314 | Expanded( 315 | flex: 1, 316 | child: Text(renderDailyValue(food.iron, multiplier, null), textAlign: TextAlign.right,), 317 | ), 318 | ], 319 | ), 320 | Divider(thickness: 2.0, color: Theme.of(context).textTheme.body1.color), 321 | Row( 322 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 323 | children: [ 324 | Expanded( 325 | flex: 3, 326 | child: Padding( 327 | padding: EdgeInsets.only(left: 16.0), 328 | child: Text("Caffeine"), 329 | ), 330 | ), 331 | Expanded( 332 | flex: 1, 333 | child: Text("${food.caffeine?.toStringAsFixed(1) ?? '?'} mg", textAlign: TextAlign.right,), 334 | ), 335 | Expanded( 336 | flex: 1, 337 | child: Text(renderDailyValue(food.caffeine, multiplier, null), textAlign: TextAlign.right,), 338 | ), 339 | ], 340 | ), 341 | Row( 342 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 343 | children: [ 344 | Expanded( 345 | flex: 3, 346 | child: Padding( 347 | padding: EdgeInsets.only(left: 16.0), 348 | child: Text("Alcohol"), 349 | ), 350 | ), 351 | Expanded( 352 | flex: 1, 353 | child: Text("${food.alcohol?.toStringAsFixed(1) ?? '?'} mg", textAlign: TextAlign.right,), 354 | ), 355 | Expanded( 356 | flex: 1, 357 | child: Text(renderDailyValue(food.alcohol, multiplier, null), textAlign: TextAlign.right,), 358 | ), 359 | ], 360 | ), 361 | Divider(thickness: 2.0, color: Theme.of(context).textTheme.body1.color), 362 | ], 363 | ) 364 | ) 365 | ); 366 | } 367 | } -------------------------------------------------------------------------------- /lib/screens/profile/profile_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:chubster/models/activity_level.dart'; 2 | import 'package:chubster/blocs/profile/bloc.dart'; 3 | import 'package:chubster/blocs/settings/bloc.dart'; 4 | import 'package:chubster/models/food_source.dart'; 5 | import 'package:chubster/models/sex.dart'; 6 | import 'package:chubster/models/units.dart'; 7 | import 'package:chubster/repositories/profile_repository.dart'; 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_bloc/flutter_bloc.dart'; 10 | import 'package:flutter_scale/flutter_scale.dart'; 11 | import 'package:font_awesome_flutter/font_awesome_flutter.dart'; 12 | import 'package:intl/intl.dart'; 13 | import 'package:url_launcher/url_launcher.dart'; 14 | 15 | class ProfileScreen extends StatelessWidget { 16 | const ProfileScreen({Key key}) : super(key: key); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | final ProfileRepository profileRepository = 21 | RepositoryProvider.of(context); 22 | assert(profileRepository != null); 23 | 24 | return BlocBuilder( 25 | builder: (context, profile) { 26 | final ProfileBloc profileBloc = BlocProvider.of(context); 27 | final SettingsBloc settingsBloc = BlocProvider.of(context); 28 | 29 | IconData sexIcon; 30 | switch (profile.sex) { 31 | case Sex.male: 32 | sexIcon = FontAwesomeIcons.male; 33 | break; 34 | case Sex.female: 35 | sexIcon = FontAwesomeIcons.female; 36 | break; 37 | case Sex.other: 38 | sexIcon = FontAwesomeIcons.genderless; 39 | break; 40 | } 41 | 42 | return ListView( 43 | children: [ 44 | Padding( 45 | padding: EdgeInsets.fromLTRB(16.0, 8.0, 16.0, 4.0), 46 | child: Text("Profile", 47 | style: TextStyle( 48 | color: Theme.of(context).accentColor, 49 | fontWeight: FontWeight.w800)), 50 | ), 51 | Container( 52 | color: Theme.of(context).dialogBackgroundColor, 53 | child: Column( 54 | children: [ 55 | Padding( 56 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 57 | child: ListTile( 58 | title: Text("Birthday"), 59 | subtitle: Text(new DateFormat.yMMMd().format(profile.birthday)), 60 | trailing: Icon(FontAwesomeIcons.chevronRight, color: Theme.of(context).accentColor), 61 | leading: Icon(FontAwesomeIcons.birthdayCake), 62 | onTap: () { 63 | showDatePicker( 64 | context: context, 65 | initialDate: profile.birthday, 66 | firstDate: DateTime.now().subtract(Duration(days: (365.25 * 80).floor())), 67 | lastDate: DateTime(DateTime.now().year), 68 | ) 69 | .then((DateTime newBirthday) { 70 | if(newBirthday != null) { 71 | profileBloc.add(SetBirthday(newBirthday)); 72 | } 73 | }); 74 | }, 75 | )), 76 | Padding( 77 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 78 | child: ListTile( 79 | title: Text("Sex"), 80 | subtitle: Text(profile.sex.stringify), 81 | trailing: Icon(FontAwesomeIcons.chevronRight, color: Theme.of(context).accentColor), 82 | leading: Icon(sexIcon), 83 | onTap: () => showModalBottomSheet( 84 | context: context, 85 | builder: (context) => Column( 86 | mainAxisSize: MainAxisSize.min, 87 | children: [ 88 | RadioListTile( 89 | title: Text(Sex.male.stringify), 90 | value: Sex.male, 91 | groupValue: profile.sex, 92 | onChanged: (Sex value) { 93 | profileBloc.add(ChangeSex(Sex.male)); 94 | Navigator.pop(context); 95 | }, 96 | ), 97 | RadioListTile( 98 | title: Text(Sex.female.stringify), 99 | value: Sex.female, 100 | groupValue: profile.sex, 101 | onChanged: (Sex value) { 102 | profileBloc.add(ChangeSex(Sex.female)); 103 | Navigator.pop(context); 104 | }, 105 | ), 106 | RadioListTile( 107 | title: Text(Sex.other.stringify), 108 | value: Sex.other, 109 | groupValue: profile.sex, 110 | onChanged: (Sex value) { 111 | profileBloc.add(ChangeSex(Sex.other)); 112 | Navigator.pop(context); 113 | }, 114 | ), 115 | ], 116 | )), 117 | )), 118 | Padding( 119 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 120 | child: ListTile( 121 | title: Text("Height"), 122 | subtitle: profile.height != null 123 | ? Text(profile.height.value.toStringAsFixed(2) + 124 | " " + 125 | profile.height.unitsStr) 126 | : Text("—"), 127 | trailing: Icon(FontAwesomeIcons.chevronRight, color: Theme.of(context).accentColor), 128 | leading: Icon(FontAwesomeIcons.ruler), 129 | onTap: () => showModalBottomSheet( 130 | context: context, builder: (context) => HeightsSheet()), 131 | )), 132 | Padding( 133 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 134 | child: ListTile( 135 | title: Text("Weight"), 136 | subtitle: profile.weight != null 137 | ? Text(profile.weight.value.toStringAsFixed(1) + 138 | " " + 139 | profile.weight.unitsStr) 140 | : Text("—"), 141 | trailing: Icon(FontAwesomeIcons.chevronRight, color: Theme.of(context).accentColor), 142 | leading: Icon(FontAwesomeIcons.weight), 143 | onTap: () => showModalBottomSheet( 144 | context: context, builder: (context) => WeightSheet()).then((_) => profileBloc.add(RecordWeight())), 145 | )), 146 | Padding( 147 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 148 | child: ListTile( 149 | title: Text("Activity Level"), 150 | subtitle: Text('${profile.activityLevel.stringify} (${profile.activityLevel.description})'), 151 | trailing: Icon(FontAwesomeIcons.chevronRight, color: Theme.of(context).accentColor), 152 | leading: Icon(FontAwesomeIcons.dumbbell), 153 | onTap: () => showModalBottomSheet( 154 | context: context, 155 | builder: (context) => Column( 156 | mainAxisSize: MainAxisSize.min, 157 | children: [ 158 | RadioListTile( 159 | title: Text(ActivityLevel.sedentary.stringify), 160 | subtitle: Text(ActivityLevel.sedentary.description), 161 | value: ActivityLevel.sedentary, 162 | groupValue: profile.activityLevel, 163 | onChanged: (ActivityLevel value) { 164 | profileBloc.add(ChangeActivityLevel(ActivityLevel.sedentary)); 165 | Navigator.pop(context); 166 | }, 167 | ), 168 | RadioListTile( 169 | title: Text(ActivityLevel.light.stringify), 170 | subtitle: Text(ActivityLevel.light.description), 171 | value: ActivityLevel.light, 172 | groupValue: profile.activityLevel, 173 | onChanged: (ActivityLevel value) { 174 | profileBloc.add(ChangeActivityLevel(ActivityLevel.light)); 175 | Navigator.pop(context); 176 | }, 177 | ), 178 | RadioListTile( 179 | title: Text(ActivityLevel.moderate.stringify), 180 | subtitle: Text(ActivityLevel.moderate.description), 181 | value: ActivityLevel.moderate, 182 | groupValue: profile.activityLevel, 183 | onChanged: (ActivityLevel value) { 184 | profileBloc.add(ChangeActivityLevel(ActivityLevel.moderate)); 185 | Navigator.pop(context); 186 | }, 187 | ), 188 | RadioListTile( 189 | title: Text(ActivityLevel.very.stringify), 190 | subtitle: Text(ActivityLevel.very.description), 191 | value: ActivityLevel.very, 192 | groupValue: profile.activityLevel, 193 | onChanged: (ActivityLevel value) { 194 | profileBloc.add(ChangeActivityLevel(ActivityLevel.very)); 195 | Navigator.pop(context); 196 | }, 197 | ), 198 | RadioListTile( 199 | title: Text(ActivityLevel.extra.stringify), 200 | subtitle: Text(ActivityLevel.extra.description), 201 | value: ActivityLevel.extra, 202 | groupValue: profile.activityLevel, 203 | onChanged: (ActivityLevel value) { 204 | profileBloc.add(ChangeActivityLevel(ActivityLevel.extra)); 205 | Navigator.pop(context); 206 | }, 207 | ), 208 | ], 209 | )), 210 | )), 211 | Padding( 212 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 213 | child: ListTile( 214 | title: Text("BMI"), 215 | subtitle: profile.bmi != null 216 | ? Text(profile.bmi.toStringAsFixed(1)) 217 | : Text("—"), 218 | leading: Icon(FontAwesomeIcons.user), 219 | )), 220 | Padding( 221 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 222 | child: ListTile( 223 | title: Text("Body Fat"), 224 | subtitle: profile.bodyFatPercent != null 225 | ? Text("Estimated " + profile.bodyFatPercent.toStringAsFixed(0) + "%") 226 | : Text("—"), 227 | leading: Icon(FontAwesomeIcons.percentage), 228 | )), 229 | Padding( 230 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 231 | child: ListTile( 232 | title: Text("Resting Energy / Day"), 233 | subtitle: profile.restingDailyEnergy != null 234 | ? Text("Estimated " + profile.restingDailyEnergy.toStringAsFixed(0) + " kCal") 235 | : Text("—"), 236 | leading: Icon(FontAwesomeIcons.bed), 237 | )), 238 | Padding( 239 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 240 | child: ListTile( 241 | title: Text("Total Energy / Day"), 242 | subtitle: profile.totalDailyEnergy != null 243 | ? Text("Estimated " + profile.totalDailyEnergy.toStringAsFixed(0) + " kCal") 244 | : Text("—"), 245 | leading: Icon(FontAwesomeIcons.fire), 246 | )), 247 | ], 248 | ) 249 | ), 250 | Padding( 251 | padding: EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 4.0), 252 | child: Text("Food Databases", 253 | style: TextStyle( 254 | color: Theme.of(context).accentColor, 255 | fontWeight: FontWeight.w800)), 256 | ), 257 | Container( 258 | color: Theme.of(context).dialogBackgroundColor, 259 | child: BlocBuilder( 260 | builder: (context, settingsState) => Column( 261 | children: [ 262 | Padding( 263 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 264 | child: ListTile( 265 | title: Text("My Foods"), 266 | trailing: Switch.adaptive( 267 | activeColor: Theme.of(context).accentColor, 268 | value: settingsState.localActive, 269 | onChanged: (active) => settingsBloc.add(SetFoodsSourceEvent(FoodSource.local, active)), 270 | ), 271 | leading: Icon(FontAwesomeIcons.userAstronaut), 272 | onTap: () => settingsBloc.add(ToggleFoodsSourceEvent(FoodSource.local)), 273 | ) 274 | ), 275 | Padding( 276 | padding: EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 0.0), 277 | child: ListTile( 278 | title: Text("Canadian Nutrient File"), 279 | subtitle: new InkWell( 280 | child: new Text( 281 | 'Canadian Nutrient File, Health Canada, 2015', 282 | style: TextStyle( 283 | decoration: TextDecoration.underline, 284 | color: Theme.of(context).textTheme.caption.decorationColor, 285 | fontSize: Theme.of(context).textTheme.caption.fontSize, 286 | ) 287 | ), 288 | onTap: () => _launchURL('https://food-nutrition.canada.ca/cnf-fce/index-eng.jsp') 289 | ), 290 | trailing: Switch.adaptive( 291 | activeColor: Theme.of(context).accentColor, 292 | value: settingsState.cnfActive, 293 | onChanged: (active) => settingsBloc.add(SetFoodsSourceEvent(FoodSource.cnf, active)), 294 | ), 295 | leading: Icon(FontAwesomeIcons.canadianMapleLeaf), 296 | onTap: () => settingsBloc.add(ToggleFoodsSourceEvent(FoodSource.cnf)), 297 | ) 298 | ), 299 | ], 300 | ), 301 | ) 302 | ) 303 | ], 304 | ); 305 | }, 306 | ); 307 | } 308 | 309 | Future _launchURL(String url) async { 310 | if (await canLaunch(url)) { 311 | await launch(url); 312 | } 313 | else { 314 | print('Could not launch $url'); 315 | } 316 | } 317 | } 318 | 319 | class HeightsSheet extends StatefulWidget { 320 | HeightsSheet({Key key}) : super(key: key); 321 | 322 | @override 323 | _HeightsSheetState createState() => _HeightsSheetState(); 324 | } 325 | 326 | class _HeightsSheetState extends State { 327 | ScrollController _scaleController; 328 | int feet; 329 | int inches; 330 | CentiMeters cm; 331 | 332 | @override 333 | void initState() { 334 | _scaleController = ScrollController(); 335 | feet = 0; 336 | inches = 0; 337 | cm = CentiMeters(0); 338 | super.initState(); 339 | } 340 | 341 | void _setHeight() { 342 | Meters newHeight = cm.toMeters(); 343 | BlocProvider.of(context).add(SetHeight(newHeight)); 344 | } 345 | 346 | @override 347 | Widget build(BuildContext context) { 348 | return Row( 349 | children: [ 350 | Expanded( 351 | child: Center( 352 | child: Column( 353 | mainAxisSize: MainAxisSize.min, 354 | children: [ 355 | Text("Height:", style: Theme.of(context).textTheme.title), 356 | Padding( 357 | padding: EdgeInsets.fromLTRB(0, 8, 0, 0), 358 | child: Text("$feet ft $inches in"), 359 | ), 360 | Padding( 361 | padding: EdgeInsets.fromLTRB(0, 8, 0, 0), 362 | child: Text("${cm.value.toStringAsFixed(1)} ${cm.unitsStr}"), 363 | ), 364 | ], 365 | ), 366 | ), 367 | ), 368 | VerticalScale( 369 | maxValue: 8, 370 | linesBetweenTwoPoints: 11, 371 | middleLineAt: 6, 372 | scaleColor: Theme.of(context).accentColor, 373 | lineColor: Colors.white, 374 | scaleController: _scaleController, 375 | onChanged: (int scalePoints) { 376 | int inchOffest = scalePoints ~/ 20; 377 | Feet newHeightFeet = Feet(feet + inches.toDouble() / 12.0); 378 | Meters newHeight = newHeightFeet.toMeters(); 379 | setState(() { 380 | feet = inchOffest ~/ 12; 381 | inches = inchOffest % 12; 382 | cm = newHeight.toCentiMeters(); 383 | }); 384 | _setHeight(); 385 | }, 386 | ) 387 | ], 388 | ); 389 | } 390 | } 391 | 392 | class WeightSheet extends StatefulWidget { 393 | WeightSheet({Key key}) : super(key: key); 394 | 395 | @override 396 | _WeightSheetState createState() => _WeightSheetState(); 397 | } 398 | 399 | class _WeightSheetState extends State { 400 | ScrollController _scaleController; 401 | Lbs lbs; 402 | 403 | @override 404 | void initState() { 405 | WeightUnits startWeight = BlocProvider.of(context).state.weight; 406 | if(startWeight == null) startWeight = Lbs(200); 407 | 408 | _scaleController = ScrollController(initialScrollOffset: (200 * startWeight.toLbs().value).toDouble()); 409 | lbs = startWeight.toLbs(); 410 | super.initState(); 411 | } 412 | 413 | @override 414 | Widget build(BuildContext context) { 415 | return Column( 416 | mainAxisSize: MainAxisSize.min, 417 | children: [ 418 | Expanded( 419 | child: Center( 420 | child: Column( 421 | mainAxisSize: MainAxisSize.min, 422 | children: [ 423 | Text("Weight", style: Theme.of(context).textTheme.title), 424 | Padding( 425 | padding: EdgeInsets.only(top: 8), 426 | child: Text("${lbs.value.toStringAsFixed(1)} ${lbs.unitsStr}"), 427 | ) 428 | ], 429 | ) 430 | ) 431 | ), 432 | HorizontalScale( 433 | maxValue: 400, 434 | linesBetweenTwoPoints: 9, 435 | middleLineAt: 5, 436 | scaleColor: Theme.of(context).accentColor, 437 | lineColor: Colors.white, 438 | scaleController: _scaleController, 439 | onChanged: (int scalePoints) { 440 | setState(() { 441 | int tenTimesLbs = scalePoints ~/ 20; 442 | lbs = Lbs(tenTimesLbs.toDouble() / 10.0); 443 | BlocProvider.of(context).add(SetWeight(lbs)); 444 | }); 445 | } 446 | ), 447 | ], 448 | ); 449 | } 450 | } -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 24568A5C5A8188F928CBBAB7 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBBABADA125CF8B88AFBB3BB /* Pods_Runner.framework */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 16 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 17 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 43 | 3BE5FCE807384C0A95441A3C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 44 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 45 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 46 | 79D1BCC46EFCEA20AD2BA6C4 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 48 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 49 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 50 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 51 | 97C146EE1CF9000F007C117D /* Chubster.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Chubster.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 9E9AD35335790392718C605F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 57 | EBBABADA125CF8B88AFBB3BB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 67 | 24568A5C5A8188F928CBBAB7 /* Pods_Runner.framework in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 9740EEB11CF90186004384FC /* Flutter */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 3B80C3931E831B6300D905FE /* App.framework */, 78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 83 | ); 84 | name = Flutter; 85 | sourceTree = ""; 86 | }; 87 | 97C146E51CF9000F007C117D = { 88 | isa = PBXGroup; 89 | children = ( 90 | 9740EEB11CF90186004384FC /* Flutter */, 91 | 97C146F01CF9000F007C117D /* Runner */, 92 | 97C146EF1CF9000F007C117D /* Products */, 93 | A7CFD2BA0EF8B78BB07A08FE /* Pods */, 94 | EFF43FDE6D542A78A69CF333 /* Frameworks */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 97C146EF1CF9000F007C117D /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 97C146EE1CF9000F007C117D /* Chubster.app */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | 97C146F01CF9000F007C117D /* Runner */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 110 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 111 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 112 | 97C147021CF9000F007C117D /* Info.plist */, 113 | 97C146F11CF9000F007C117D /* Supporting Files */, 114 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 115 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 116 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 117 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 118 | ); 119 | path = Runner; 120 | sourceTree = ""; 121 | }; 122 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | A7CFD2BA0EF8B78BB07A08FE /* Pods */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 9E9AD35335790392718C605F /* Pods-Runner.debug.xcconfig */, 133 | 79D1BCC46EFCEA20AD2BA6C4 /* Pods-Runner.release.xcconfig */, 134 | 3BE5FCE807384C0A95441A3C /* Pods-Runner.profile.xcconfig */, 135 | ); 136 | path = Pods; 137 | sourceTree = ""; 138 | }; 139 | EFF43FDE6D542A78A69CF333 /* Frameworks */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | EBBABADA125CF8B88AFBB3BB /* Pods_Runner.framework */, 143 | ); 144 | name = Frameworks; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 97C146ED1CF9000F007C117D /* Runner */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 153 | buildPhases = ( 154 | F1CEC1D2ADB515F37FAE7CE8 /* [CP] Check Pods Manifest.lock */, 155 | 9740EEB61CF901F6004384FC /* Run Script */, 156 | 97C146EA1CF9000F007C117D /* Sources */, 157 | 97C146EB1CF9000F007C117D /* Frameworks */, 158 | 97C146EC1CF9000F007C117D /* Resources */, 159 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 160 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 161 | BCF1D6C4BFB95E381DCBC748 /* [CP] Embed Pods Frameworks */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | ); 167 | name = Runner; 168 | productName = Runner; 169 | productReference = 97C146EE1CF9000F007C117D /* Chubster.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | /* End PBXNativeTarget section */ 173 | 174 | /* Begin PBXProject section */ 175 | 97C146E61CF9000F007C117D /* Project object */ = { 176 | isa = PBXProject; 177 | attributes = { 178 | LastUpgradeCheck = 1020; 179 | ORGANIZATIONNAME = ""; 180 | TargetAttributes = { 181 | 97C146ED1CF9000F007C117D = { 182 | CreatedOnToolsVersion = 7.3.1; 183 | DevelopmentTeam = XF5UYMLH66; 184 | LastSwiftMigration = 1100; 185 | ProvisioningStyle = Manual; 186 | }; 187 | }; 188 | }; 189 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 190 | compatibilityVersion = "Xcode 3.2"; 191 | developmentRegion = en; 192 | hasScannedForEncodings = 0; 193 | knownRegions = ( 194 | en, 195 | Base, 196 | ); 197 | mainGroup = 97C146E51CF9000F007C117D; 198 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 199 | projectDirPath = ""; 200 | projectRoot = ""; 201 | targets = ( 202 | 97C146ED1CF9000F007C117D /* Runner */, 203 | ); 204 | }; 205 | /* End PBXProject section */ 206 | 207 | /* Begin PBXResourcesBuildPhase section */ 208 | 97C146EC1CF9000F007C117D /* Resources */ = { 209 | isa = PBXResourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 213 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 214 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 215 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | /* End PBXResourcesBuildPhase section */ 220 | 221 | /* Begin PBXShellScriptBuildPhase section */ 222 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 223 | isa = PBXShellScriptBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | ); 227 | inputPaths = ( 228 | ); 229 | name = "Thin Binary"; 230 | outputPaths = ( 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | shellPath = /bin/sh; 234 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 235 | }; 236 | 9740EEB61CF901F6004384FC /* Run Script */ = { 237 | isa = PBXShellScriptBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | inputPaths = ( 242 | ); 243 | name = "Run Script"; 244 | outputPaths = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | shellPath = /bin/sh; 248 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 249 | }; 250 | BCF1D6C4BFB95E381DCBC748 /* [CP] Embed Pods Frameworks */ = { 251 | isa = PBXShellScriptBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | ); 255 | inputPaths = ( 256 | ); 257 | name = "[CP] Embed Pods Frameworks"; 258 | outputPaths = ( 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | shellPath = /bin/sh; 262 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 263 | showEnvVarsInLog = 0; 264 | }; 265 | F1CEC1D2ADB515F37FAE7CE8 /* [CP] Check Pods Manifest.lock */ = { 266 | isa = PBXShellScriptBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | ); 270 | inputFileListPaths = ( 271 | ); 272 | inputPaths = ( 273 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 274 | "${PODS_ROOT}/Manifest.lock", 275 | ); 276 | name = "[CP] Check Pods Manifest.lock"; 277 | outputFileListPaths = ( 278 | ); 279 | outputPaths = ( 280 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | shellPath = /bin/sh; 284 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 285 | showEnvVarsInLog = 0; 286 | }; 287 | /* End PBXShellScriptBuildPhase section */ 288 | 289 | /* Begin PBXSourcesBuildPhase section */ 290 | 97C146EA1CF9000F007C117D /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 295 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | }; 299 | /* End PBXSourcesBuildPhase section */ 300 | 301 | /* Begin PBXVariantGroup section */ 302 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 303 | isa = PBXVariantGroup; 304 | children = ( 305 | 97C146FB1CF9000F007C117D /* Base */, 306 | ); 307 | name = Main.storyboard; 308 | sourceTree = ""; 309 | }; 310 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 311 | isa = PBXVariantGroup; 312 | children = ( 313 | 97C147001CF9000F007C117D /* Base */, 314 | ); 315 | name = LaunchScreen.storyboard; 316 | sourceTree = ""; 317 | }; 318 | /* End PBXVariantGroup section */ 319 | 320 | /* Begin XCBuildConfiguration section */ 321 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 322 | isa = XCBuildConfiguration; 323 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 324 | buildSettings = { 325 | ALWAYS_SEARCH_USER_PATHS = NO; 326 | CLANG_ANALYZER_NONNULL = YES; 327 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 328 | CLANG_CXX_LIBRARY = "libc++"; 329 | CLANG_ENABLE_MODULES = YES; 330 | CLANG_ENABLE_OBJC_ARC = YES; 331 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 332 | CLANG_WARN_BOOL_CONVERSION = YES; 333 | CLANG_WARN_COMMA = YES; 334 | CLANG_WARN_CONSTANT_CONVERSION = YES; 335 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 336 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 337 | CLANG_WARN_EMPTY_BODY = YES; 338 | CLANG_WARN_ENUM_CONVERSION = YES; 339 | CLANG_WARN_INFINITE_RECURSION = YES; 340 | CLANG_WARN_INT_CONVERSION = YES; 341 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 343 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 344 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 345 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 346 | CLANG_WARN_STRICT_PROTOTYPES = YES; 347 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 348 | CLANG_WARN_UNREACHABLE_CODE = YES; 349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 350 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 351 | COPY_PHASE_STRIP = NO; 352 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 353 | ENABLE_NS_ASSERTIONS = NO; 354 | ENABLE_STRICT_OBJC_MSGSEND = YES; 355 | GCC_C_LANGUAGE_STANDARD = gnu99; 356 | GCC_NO_COMMON_BLOCKS = YES; 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 364 | MTL_ENABLE_DEBUG_INFO = NO; 365 | SDKROOT = iphoneos; 366 | SUPPORTED_PLATFORMS = iphoneos; 367 | TARGETED_DEVICE_FAMILY = "1,2"; 368 | VALIDATE_PRODUCT = YES; 369 | }; 370 | name = Profile; 371 | }; 372 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 373 | isa = XCBuildConfiguration; 374 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | CLANG_ENABLE_MODULES = YES; 378 | CODE_SIGN_IDENTITY = "iPhone Distribution"; 379 | CODE_SIGN_STYLE = Manual; 380 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 381 | DEVELOPMENT_TEAM = XF5UYMLH66; 382 | ENABLE_BITCODE = NO; 383 | FRAMEWORK_SEARCH_PATHS = ( 384 | "$(inherited)", 385 | "$(PROJECT_DIR)/Flutter", 386 | ); 387 | INFOPLIST_FILE = Runner/Info.plist; 388 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 389 | LIBRARY_SEARCH_PATHS = ( 390 | "$(inherited)", 391 | "$(PROJECT_DIR)/Flutter", 392 | ); 393 | PRODUCT_BUNDLE_IDENTIFIER = "ca.hamaluik.chubster-nutrition"; 394 | PRODUCT_NAME = Chubster; 395 | PROVISIONING_PROFILE_SPECIFIER = "Chubster - Kenton's iPhone 7+"; 396 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 397 | SWIFT_VERSION = 5.0; 398 | VERSIONING_SYSTEM = "apple-generic"; 399 | }; 400 | name = Profile; 401 | }; 402 | 97C147031CF9000F007C117D /* Debug */ = { 403 | isa = XCBuildConfiguration; 404 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 405 | buildSettings = { 406 | ALWAYS_SEARCH_USER_PATHS = NO; 407 | CLANG_ANALYZER_NONNULL = YES; 408 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 409 | CLANG_CXX_LIBRARY = "libc++"; 410 | CLANG_ENABLE_MODULES = YES; 411 | CLANG_ENABLE_OBJC_ARC = YES; 412 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 413 | CLANG_WARN_BOOL_CONVERSION = YES; 414 | CLANG_WARN_COMMA = YES; 415 | CLANG_WARN_CONSTANT_CONVERSION = YES; 416 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 417 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 418 | CLANG_WARN_EMPTY_BODY = YES; 419 | CLANG_WARN_ENUM_CONVERSION = YES; 420 | CLANG_WARN_INFINITE_RECURSION = YES; 421 | CLANG_WARN_INT_CONVERSION = YES; 422 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 423 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 424 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 425 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 426 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 427 | CLANG_WARN_STRICT_PROTOTYPES = YES; 428 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 429 | CLANG_WARN_UNREACHABLE_CODE = YES; 430 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 431 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 432 | COPY_PHASE_STRIP = NO; 433 | DEBUG_INFORMATION_FORMAT = dwarf; 434 | ENABLE_STRICT_OBJC_MSGSEND = YES; 435 | ENABLE_TESTABILITY = YES; 436 | GCC_C_LANGUAGE_STANDARD = gnu99; 437 | GCC_DYNAMIC_NO_PIC = NO; 438 | GCC_NO_COMMON_BLOCKS = YES; 439 | GCC_OPTIMIZATION_LEVEL = 0; 440 | GCC_PREPROCESSOR_DEFINITIONS = ( 441 | "DEBUG=1", 442 | "$(inherited)", 443 | ); 444 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 445 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 446 | GCC_WARN_UNDECLARED_SELECTOR = YES; 447 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 448 | GCC_WARN_UNUSED_FUNCTION = YES; 449 | GCC_WARN_UNUSED_VARIABLE = YES; 450 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 451 | MTL_ENABLE_DEBUG_INFO = YES; 452 | ONLY_ACTIVE_ARCH = YES; 453 | SDKROOT = iphoneos; 454 | TARGETED_DEVICE_FAMILY = "1,2"; 455 | }; 456 | name = Debug; 457 | }; 458 | 97C147041CF9000F007C117D /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 461 | buildSettings = { 462 | ALWAYS_SEARCH_USER_PATHS = NO; 463 | CLANG_ANALYZER_NONNULL = YES; 464 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 465 | CLANG_CXX_LIBRARY = "libc++"; 466 | CLANG_ENABLE_MODULES = YES; 467 | CLANG_ENABLE_OBJC_ARC = YES; 468 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 469 | CLANG_WARN_BOOL_CONVERSION = YES; 470 | CLANG_WARN_COMMA = YES; 471 | CLANG_WARN_CONSTANT_CONVERSION = YES; 472 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 473 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 474 | CLANG_WARN_EMPTY_BODY = YES; 475 | CLANG_WARN_ENUM_CONVERSION = YES; 476 | CLANG_WARN_INFINITE_RECURSION = YES; 477 | CLANG_WARN_INT_CONVERSION = YES; 478 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 479 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 480 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 481 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 482 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 483 | CLANG_WARN_STRICT_PROTOTYPES = YES; 484 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 485 | CLANG_WARN_UNREACHABLE_CODE = YES; 486 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 487 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 488 | COPY_PHASE_STRIP = NO; 489 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 490 | ENABLE_NS_ASSERTIONS = NO; 491 | ENABLE_STRICT_OBJC_MSGSEND = YES; 492 | GCC_C_LANGUAGE_STANDARD = gnu99; 493 | GCC_NO_COMMON_BLOCKS = YES; 494 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 495 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 496 | GCC_WARN_UNDECLARED_SELECTOR = YES; 497 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 498 | GCC_WARN_UNUSED_FUNCTION = YES; 499 | GCC_WARN_UNUSED_VARIABLE = YES; 500 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 501 | MTL_ENABLE_DEBUG_INFO = NO; 502 | SDKROOT = iphoneos; 503 | SUPPORTED_PLATFORMS = iphoneos; 504 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 505 | TARGETED_DEVICE_FAMILY = "1,2"; 506 | VALIDATE_PRODUCT = YES; 507 | }; 508 | name = Release; 509 | }; 510 | 97C147061CF9000F007C117D /* Debug */ = { 511 | isa = XCBuildConfiguration; 512 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 513 | buildSettings = { 514 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 515 | CLANG_ENABLE_MODULES = YES; 516 | CODE_SIGN_IDENTITY = "iPhone Distribution"; 517 | CODE_SIGN_STYLE = Manual; 518 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 519 | DEVELOPMENT_TEAM = XF5UYMLH66; 520 | ENABLE_BITCODE = NO; 521 | FRAMEWORK_SEARCH_PATHS = ( 522 | "$(inherited)", 523 | "$(PROJECT_DIR)/Flutter", 524 | ); 525 | INFOPLIST_FILE = Runner/Info.plist; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 527 | LIBRARY_SEARCH_PATHS = ( 528 | "$(inherited)", 529 | "$(PROJECT_DIR)/Flutter", 530 | ); 531 | PRODUCT_BUNDLE_IDENTIFIER = "ca.hamaluik.chubster-nutrition"; 532 | PRODUCT_NAME = Chubster; 533 | PROVISIONING_PROFILE_SPECIFIER = "Chubster - Kenton's iPhone 7+"; 534 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 535 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 536 | SWIFT_VERSION = 5.0; 537 | VERSIONING_SYSTEM = "apple-generic"; 538 | }; 539 | name = Debug; 540 | }; 541 | 97C147071CF9000F007C117D /* Release */ = { 542 | isa = XCBuildConfiguration; 543 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 544 | buildSettings = { 545 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 546 | CLANG_ENABLE_MODULES = YES; 547 | CODE_SIGN_IDENTITY = "iPhone Distribution"; 548 | CODE_SIGN_STYLE = Manual; 549 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 550 | DEVELOPMENT_TEAM = XF5UYMLH66; 551 | ENABLE_BITCODE = NO; 552 | FRAMEWORK_SEARCH_PATHS = ( 553 | "$(inherited)", 554 | "$(PROJECT_DIR)/Flutter", 555 | ); 556 | INFOPLIST_FILE = Runner/Info.plist; 557 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 558 | LIBRARY_SEARCH_PATHS = ( 559 | "$(inherited)", 560 | "$(PROJECT_DIR)/Flutter", 561 | ); 562 | PRODUCT_BUNDLE_IDENTIFIER = "ca.hamaluik.chubster-nutrition"; 563 | PRODUCT_NAME = Chubster; 564 | PROVISIONING_PROFILE_SPECIFIER = "Chubster - Kenton's iPhone 7+"; 565 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 566 | SWIFT_VERSION = 5.0; 567 | VERSIONING_SYSTEM = "apple-generic"; 568 | }; 569 | name = Release; 570 | }; 571 | /* End XCBuildConfiguration section */ 572 | 573 | /* Begin XCConfigurationList section */ 574 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 575 | isa = XCConfigurationList; 576 | buildConfigurations = ( 577 | 97C147031CF9000F007C117D /* Debug */, 578 | 97C147041CF9000F007C117D /* Release */, 579 | 249021D3217E4FDB00AE95B9 /* Profile */, 580 | ); 581 | defaultConfigurationIsVisible = 0; 582 | defaultConfigurationName = Release; 583 | }; 584 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 97C147061CF9000F007C117D /* Debug */, 588 | 97C147071CF9000F007C117D /* Release */, 589 | 249021D4217E4FDB00AE95B9 /* Profile */, 590 | ); 591 | defaultConfigurationIsVisible = 0; 592 | defaultConfigurationName = Release; 593 | }; 594 | /* End XCConfigurationList section */ 595 | }; 596 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 597 | } 598 | --------------------------------------------------------------------------------