diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0fa6b67 --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..7539b43 --- /dev/null +++ b/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c + channel: stable + +project_type: app diff --git a/README.md b/README.md new file mode 100644 index 0000000..231bdcd --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# leg_barkr_app + +The user app for the 1st coursework of Embedded Systems + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..61b6c4d --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..6f56801 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..ab2de67 --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,68 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion flutter.compileSdkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.legbarkr.leg_barkr_app" + minSdkVersion 20 + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..1160513 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..6237088 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/legbarkr/leg_barkr_app/MainActivity.kt b/android/app/src/main/kotlin/com/legbarkr/leg_barkr_app/MainActivity.kt new file mode 100644 index 0000000..227f50e --- /dev/null +++ b/android/app/src/main/kotlin/com/legbarkr/leg_barkr_app/MainActivity.kt @@ -0,0 +1,5 @@ +package com.legbarkr.leg_barkr_app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..3db14bb --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..d460d1e --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..1160513 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..4256f91 --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.6.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:4.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..94adc3a --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..bc6a58a --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..44e62bc --- /dev/null +++ b/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..8d4492f --- /dev/null +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 9.0 + + diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..03212c0 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,481 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1300; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.legbarkr.legBarkrApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.legbarkr.legBarkrApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.legbarkr.legBarkrApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..c87d15a --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..ba9ad86 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,16 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + + GMSServices.provideAPIKey("AIzaSyDzQFpqa2XFmVSHmBFNjuQ37iFcku9imF4") + + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..28c6bf0 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..2ccbfd9 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..f091b6b Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cde121 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..d0ef06e Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..dcdc230 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..2ccbfd9 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..c8f9ed8 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..a6d6b86 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..a6d6b86 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..75b2d16 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..c4df70d Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..6a84f41 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..d0e1f58 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +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. \ No newline at end of file diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist new file mode 100644 index 0000000..f06ea86 --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Leg Barkr App + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + leg_barkr_app + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + NSLocationWhenInUseUsageDescription + This app needs access to location when open. + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 0000000..e51c0a0 --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,60 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + // ignore: missing_enum_constant_in_switch + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyAmUEAR1SB7bf29XoGNpOExo_GWoNl68J8', + appId: '1:903921644523:android:8b1be795cfa3b71a079fae', + messagingSenderId: '903921644523', + projectId: 'leg-barkr', + storageBucket: 'leg-barkr.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyA6haaqDGLGt5gYLc_z1r0P-jWl0bF3Xlc', + appId: '1:903921644523:ios:9294b2d611ff71fc079fae', + messagingSenderId: '903921644523', + projectId: 'leg-barkr', + storageBucket: 'leg-barkr.appspot.com', + iosClientId: '903921644523-cq15mvp7kj64spro7ugkh781kvp4bm42.apps.googleusercontent.com', + iosBundleId: 'com.legbarkr.app', + ); +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..f394bfb --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,35 @@ +import 'package:firebase_core/firebase_core.dart'; +import 'package:flutter/material.dart'; +import 'package:leg_barkr_app/view/home.dart'; +import 'package:flutter/services.dart'; +import 'package:leg_barkr_app/view/auth/login_form.dart'; +import 'package:leg_barkr_app/view/auth/register_form.dart'; +import 'firebase_options.dart'; + +void main() async { + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.black12)); + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + runApp(Main()); +} + +class Main extends StatelessWidget { + const Main({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + theme: ThemeData.light(), + //home: HomeScreen(), + initialRoute: '/', + routes: { + '/': (context) => const HomeScreen(), + '/login': (context) => const LoginForm(), + '/register': (context) => const RegisterForm() + } + ); + } +} + diff --git a/lib/model/latitude_longitude.dart b/lib/model/latitude_longitude.dart new file mode 100644 index 0000000..75602d4 --- /dev/null +++ b/lib/model/latitude_longitude.dart @@ -0,0 +1,9 @@ +class LatitudeLongitude { + final double latitude; + final double longitude; + + LatitudeLongitude(this.latitude, this.longitude); + + LatitudeLongitude.fromJson(Map parsedJson): + latitude = parsedJson['latitude'], longitude = parsedJson['longitude']; +} diff --git a/lib/model/metrics_data.dart b/lib/model/metrics_data.dart new file mode 100644 index 0000000..25e35c8 --- /dev/null +++ b/lib/model/metrics_data.dart @@ -0,0 +1,16 @@ +class MetricsData{ + final double currentReading, lowestReading, highestReading, minimumPossible, maximumPossible, lowCutOff, highCutOff; + final String metric, units; + + MetricsData( + this.currentReading, + this.lowestReading, + this.highestReading, + this.minimumPossible, + this.maximumPossible, + this.lowCutOff, + this.highCutOff, + this.metric, + this.units + ); +} \ No newline at end of file diff --git a/lib/model/metrics_response.dart b/lib/model/metrics_response.dart new file mode 100644 index 0000000..13229b2 --- /dev/null +++ b/lib/model/metrics_response.dart @@ -0,0 +1,34 @@ +class MetricsResponse { + final double lastAirTemp; + final double minAirTemp; + final double maxAirTemp; + final double lastSkinTemp; + final double minSkinTemp; + final double maxSkinTemp; + final double lastHumidity; + final double maxHumidity; + final double minHumidity; + + MetricsResponse( + this.lastAirTemp, + this.minAirTemp, + this.maxAirTemp, + this.lastSkinTemp, + this.minSkinTemp, + this.maxSkinTemp, + this.lastHumidity, + this.maxHumidity, + this.minHumidity + ); + + MetricsResponse.fromJson(Map parsedJson) : + lastAirTemp = parsedJson['last_air_temp'].toDouble(), + minAirTemp = parsedJson['min_air_temp'].toDouble(), + maxAirTemp = parsedJson['max_air_temp'].toDouble(), + lastSkinTemp = parsedJson['last_skin_temp'].toDouble(), + minSkinTemp = parsedJson['min_skin_temp'].toDouble(), + maxSkinTemp = parsedJson['max_skin_temp'].toDouble(), + lastHumidity = parsedJson['last_humidity'].toDouble(), + maxHumidity = parsedJson['min_humidity'].toDouble(), + minHumidity = parsedJson['max_humidity'].toDouble(); +} \ No newline at end of file diff --git a/lib/model/steps_series.dart b/lib/model/steps_series.dart new file mode 100644 index 0000000..faf5958 --- /dev/null +++ b/lib/model/steps_series.dart @@ -0,0 +1,6 @@ +class StepsSeries { + final DateTime date; + final int steps; + + StepsSeries(this.date, this.steps); +} \ No newline at end of file diff --git a/lib/model/temp_series.dart b/lib/model/temp_series.dart new file mode 100644 index 0000000..c3fa6c7 --- /dev/null +++ b/lib/model/temp_series.dart @@ -0,0 +1,6 @@ +class TempSeries { + final DateTime date; + final double temperature; + + TempSeries(this.date, this.temperature); +} \ No newline at end of file diff --git a/lib/service/auth_service.dart b/lib/service/auth_service.dart new file mode 100644 index 0000000..deed8d3 --- /dev/null +++ b/lib/service/auth_service.dart @@ -0,0 +1,25 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints; + +class AuthService{ + Future> getUserDevices(String uid) async { + final response = await http.get( + Uri.parse(Endpoints.getUserDevices), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'UID': uid, + }, + ); + if (response.statusCode == 200){ + List list = jsonDecode(response.body)['devices']; + List res = []; + for (final l in list) { + res.add(l.toString()); + } + return res; + } else{ + return []; + } + } +} \ No newline at end of file diff --git a/lib/service/map_service.dart b/lib/service/map_service.dart new file mode 100644 index 0000000..5880d17 --- /dev/null +++ b/lib/service/map_service.dart @@ -0,0 +1,36 @@ +import 'dart:convert'; +import 'package:geolocator/geolocator.dart'; +import 'package:http/http.dart' as http; +import 'package:leg_barkr_app/model/latitude_longitude.dart'; +import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints; + +class MapService{ + Future getPetLastLocation(String deviceId, String sessionToken) async { + final response = await http.get( + Uri.parse(Endpoints.getLastLocation), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': sessionToken, + 'Device-ID': deviceId, + }, + ); + if (response.statusCode == 200){ + return LatitudeLongitude.fromJson(jsonDecode(response.body)); + } else { + return throw Exception('Pet not found'); + } + } + + Future getMyLocation() async{ + LocationPermission permission; + permission = await Geolocator.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + if (permission == LocationPermission.deniedForever) { + throw Exception('Location denied'); + } + } + return await Geolocator.getCurrentPosition(); + } + +} \ No newline at end of file diff --git a/lib/service/metrics_service.dart b/lib/service/metrics_service.dart new file mode 100644 index 0000000..051de8e --- /dev/null +++ b/lib/service/metrics_service.dart @@ -0,0 +1,22 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:leg_barkr_app/model/metrics_response.dart'; +import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints; + +class MetricsService { + Future getMetricsSummary(String deviceId, String sessionToken) async { + final response = await http.get( + Uri.parse(Endpoints.getMetricsSummary), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': sessionToken, + 'Device-ID': deviceId, + }, + ); + if (response.statusCode == 200) { + return MetricsResponse.fromJson(jsonDecode(response.body)); + } else { + return MetricsResponse(0, 0, 0, 0, 0, 0, 0, 0, 0); + } + } +} \ No newline at end of file diff --git a/lib/service/steps_service.dart b/lib/service/steps_service.dart new file mode 100644 index 0000000..612e046 --- /dev/null +++ b/lib/service/steps_service.dart @@ -0,0 +1,42 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; +import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints; + +class StepsService { + Future getStepsToday(String deviceId, String sessionToken) async { + final response = await http.get( + Uri.parse(Endpoints.getStepsToday), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': sessionToken, + 'Device-ID': deviceId, + }, + ); + if (response.statusCode == 200) { + return jsonDecode(response.body)['cumulative_steps_today']; + } else { + return 0; + } + } + + Future> getStepsLastFiveDays(String deviceId, String sessionToken) async { + final response = await http.get( + Uri.parse(Endpoints.getStepsLastFiveDays), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + 'Authorization': sessionToken, + 'Device-ID': deviceId, + }, + ); + if (response.statusCode == 200) { + List list = jsonDecode(response.body)['daily_steps']; + List steps = []; + for (final l in list){ + steps.add(l); + } + return steps; + } else { + return []; + } + } +} \ No newline at end of file diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart new file mode 100644 index 0000000..5b1d596 --- /dev/null +++ b/lib/utils/constants.dart @@ -0,0 +1,13 @@ +const double LOW_AIR_TEMP_DOG = -5.0; +const double HIGH_AIR_TEMP_DOG = 29.0; +const double LOW_SKIN_TEMP_DOG = 37.5; +const double HIGH_SKIN_TEMP_DOG = 39.4; +const double LOW_HUMIDITY_DOG = 0.0; +const double HIGH_HUMIDITY_DOG = 100.0; + +const double MAX_AIR_TEMP = 50.0; +const double MIN_AIR_TEMP = -25.0; +const double MAX_SKIN_TEMP = 42; +const double MIN_SKIN_TEMP = 35; +const double MAX_HUMIDITY = 100; +const double MIN_HUMIDITY = 0; \ No newline at end of file diff --git a/lib/utils/endpoints.dart b/lib/utils/endpoints.dart new file mode 100644 index 0000000..0167263 --- /dev/null +++ b/lib/utils/endpoints.dart @@ -0,0 +1,8 @@ +const String home = "https://leg-barkr.nw.r.appspot.com/"; +const String register = "https://leg-barkr.nw.r.appspot.com/authentication/register"; +const String verify = "https://leg-barkr.nw.r.appspot.com/authentication/verify"; +const String getUserDevices = "https://leg-barkr.nw.r.appspot.com/authentication/get-user-devices"; +const String getLastLocation = "https://leg-barkr.nw.r.appspot.com/readings/location/last"; +const String getStepsToday = "https://leg-barkr.nw.r.appspot.com/readings/steps/today"; +const String getStepsLastFiveDays = "https://leg-barkr.nw.r.appspot.com/readings/steps/last-five-days"; +const String getMetricsSummary = "https://leg-barkr.nw.r.appspot.com/readings/metrics-summary"; diff --git a/lib/view/auth/login_form.dart b/lib/view/auth/login_form.dart new file mode 100644 index 0000000..6f04003 --- /dev/null +++ b/lib/view/auth/login_form.dart @@ -0,0 +1,149 @@ +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; + +class LoginForm extends StatefulWidget { + const LoginForm({Key? key}) : super(key: key); + + @override + _LoginFormState createState() => _LoginFormState(); +} + +class _LoginFormState extends State { + final GlobalKey _formKey = GlobalKey(); + late String _email, _password; + bool _loggingIn = false; + + void attemptLogin(){ + final form = _formKey.currentState; + if (form!.validate()) { + form.save(); + setState(() { _loggingIn = true; }); + loginUser(); + } else { + setState(() { _loggingIn = false; }); + } + } + + Future loginUser() async { + try { + await FirebaseAuth.instance.signInWithEmailAndPassword(email: _email, password: _password); + Navigator.pushNamed(context, "/"); + } on FirebaseAuthException catch (e) { + if (e.code == 'user-not-found') { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Invalid email"))); + setState(() { _loggingIn = false; }); + } else if (e.code == 'wrong-password') { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Incorrect password"))); + setState(() { _loggingIn = false; }); + } + } + } + + @override + Widget build(BuildContext context) { + final TextFormField emailInput = TextFormField( + autofocus: false, + cursorColor: Colors.green, + decoration: const InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.green, + width: 2 + ) + ), + hintText: 'Email', + //labelStyle: TextStyle(color: Colors.green), + ), + validator: (value) => value!.isEmpty ? "Please enter email" : null, + onSaved: (value) => _email = value!, + ); + + final TextFormField passwordInput = TextFormField( + autofocus: false, + obscureText: true, + cursorColor: Colors.green, + decoration: const InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.green, + width: 2 + ) + ), + hintText: 'Password', + //labelStyle: TextStyle(color: Colors.green), + ), + validator: (value) => value!.isEmpty ? "Please enter password" : null, + onSaved: (value) => _password = value!, + ); + + final Container loading = Container( + alignment: Alignment.center, + child: CircularProgressIndicator( + backgroundColor: Colors.green, + color: Colors.green, + ), + ); + + final Container loginBtn = Container( + width: double.infinity, + height: 50, + child: ElevatedButton( + onPressed: attemptLogin, + child: Text('Sign In'), + style: ElevatedButton.styleFrom( + alignment: Alignment.center, + primary: Colors.green, + ) + ) + ); + + final Container registerBtn = Container( + width: double.infinity, + height: 50, + child: ElevatedButton( + onPressed: (){ Navigator.pushNamed(context, '/register'); }, + child: Text('No account? Register now!', + style: TextStyle( + color: Colors.black, + fontSize: 15 + ) + ), + style: ElevatedButton.styleFrom( + alignment: Alignment.center, + primary: Colors.white, + side: BorderSide( + color: Colors.green, + width: 2 + ) + ) + ) + ); + + return Scaffold( + appBar: null, + body: Center( + child: SingleChildScrollView( + child: Form( + key: _formKey, + child:Container( + padding: EdgeInsets.all(10), + child: Column( + children: [ + emailInput, + SizedBox(height: 20), + passwordInput, + SizedBox(height: 20), + _loggingIn ? loading : loginBtn, + SizedBox(height: 20), + _loggingIn ? Text("") : registerBtn + ] + ) + ) + ), + ) + ) + ); + } +} \ No newline at end of file diff --git a/lib/view/auth/register_form.dart b/lib/view/auth/register_form.dart new file mode 100644 index 0000000..31e53a0 --- /dev/null +++ b/lib/view/auth/register_form.dart @@ -0,0 +1,261 @@ +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'package:leg_barkr_app/utils/endpoints.dart' as Endpoints; +import 'package:leg_barkr_app/view/auth/login_form.dart'; + +class RegisterForm extends StatefulWidget { + const RegisterForm({Key? key}) : super(key: key); + + @override + _RegisterFormState createState() => _RegisterFormState(); +} + +class _RegisterFormState extends State { + final GlobalKey _formKey = GlobalKey(); + late String _firstName, _lastName, _email, _password, _confirmPassword, _deviceId; + bool _registering = false; + + void attemptRegistration(){ + final form = _formKey.currentState; + if (form!.validate()) { + form.save(); + if (_password != _confirmPassword) { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Passwords do not match"))); + setState(() { _registering = false; }); + } + form.save(); + setState(() { _registering = true; }); + registerUser(); + } else { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Please enter all required fields"))); + setState(() { _registering = false; }); + } + } + + void registerUser() async { + final response = await http.post( + Uri.parse(Endpoints.register), + headers: { + 'Content-Type': 'application/json; charset=UTF-8', + }, + body: jsonEncode({ + 'name': _firstName + _lastName, + 'deviceid': _deviceId, + 'email': _email, + 'password': _password + }), + ); + if (response.statusCode == 201){ + Navigator.push(context, MaterialPageRoute(builder: (context) => LoginForm())); + } else if (response.statusCode == 400){ + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Fields missing!"))); + } else if (response.statusCode == 409){ + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("User with given email already exists"))); + } else { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Failed registration, please try again later"))); + } + setState(() { + _registering = false; + }); + } + + @override + Widget build(BuildContext context) { + final TextFormField firstNameInput = TextFormField( + autofocus: false, + cursorColor: Colors.green, + decoration: const InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.green, + width: 2 + ) + ), + hintText: 'First Name', + //labelStyle: TextStyle(color: Colors.green), + ), + validator: (value) => value!.isEmpty ? "Please enter first name" : null, + onSaved: (value) => _firstName = value!, + ); + + final TextFormField lastNameInput = TextFormField( + autofocus: false, + cursorColor: Colors.green, + decoration: const InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.green, + width: 2 + ) + ), + hintText: 'Last Name', + //labelStyle: TextStyle(color: Colors.green), + ), + validator: (value) => value!.isEmpty ? "Please enter last name" : null, + onSaved: (value) => _lastName = value!, + ); + + final TextFormField deviceInput = TextFormField( + autofocus: false, + cursorColor: Colors.green, + decoration: const InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.green, + width: 2 + ) + ), + hintText: 'Device ID', + //labelStyle: TextStyle(color: Colors.green), + ), + validator: (value) => value!.isEmpty ? "Please enter device ID" : null, + onSaved: (value) => _deviceId = value!, + ); + + final TextFormField emailInput = TextFormField( + autofocus: false, + cursorColor: Colors.green, + decoration: const InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.green, + width: 2 + ) + ), + hintText: 'Email', + //labelStyle: TextStyle(color: Colors.green), + ), + validator: (value) => value!.isEmpty ? "Please enter email" : null, + onSaved: (value) => _email = value!, + ); + + final TextFormField passwordInput = TextFormField( + autofocus: false, + obscureText: true, + cursorColor: Colors.green, + decoration: const InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.green, + width: 2 + ) + ), + hintText: 'Password', + //labelStyle: TextStyle(color: Colors.green), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter password'; + } + return null; + }, + onSaved: (value) => _password = value!, + ); + + final TextFormField confirmPasswordInput = TextFormField( + autofocus: false, + obscureText: true, + cursorColor: Colors.green, + decoration: const InputDecoration( + border: OutlineInputBorder(), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Colors.green, + width: 2 + ) + ), + hintText: 'Confirm password', + //labelStyle: TextStyle(color: Colors.green), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please confirm password'; + } + return null; + }, + onSaved: (value) => _confirmPassword = value!, + ); + + final Container loading = Container( + alignment: Alignment.center, + child: CircularProgressIndicator( + backgroundColor: Colors.green, + color: Colors.green, + ), + ); + + final Container registerBtn = Container( + width: double.infinity, + height: 50, + child: ElevatedButton( + onPressed: attemptRegistration, + child: Text('Register'), + style: ElevatedButton.styleFrom( + alignment: Alignment.center, + primary: Colors.green, + ) + ) + ); + + final Container loginBtn = Container( + width: double.infinity, + height: 50, + child: ElevatedButton( + onPressed: (){ Navigator.pushNamed(context, '/login'); }, + child: Text('Already have an account? Login now!', + style: TextStyle( + color: Colors.black, + fontSize: 15 + ) + ), + style: ElevatedButton.styleFrom( + alignment: Alignment.center, + primary: Colors.white, + side: BorderSide( + color: Colors.green, + width: 2 + ) + ) + ) + ); + + return Scaffold( + appBar: null, + body: SingleChildScrollView( + child: Form( + key: _formKey, + child:Container( + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 100), + firstNameInput, + SizedBox(height: 20), + lastNameInput, + SizedBox(height: 20), + deviceInput, + SizedBox(height: 20), + emailInput, + SizedBox(height: 20), + passwordInput, + SizedBox(height: 20), + confirmPasswordInput, + SizedBox(height: 20), + _registering ? loading : registerBtn, + SizedBox(height: 20), + _registering ? Text("") : loginBtn + ] + ) + ) + ), + ) + ); + } +} \ No newline at end of file diff --git a/lib/view/home.dart b/lib/view/home.dart new file mode 100644 index 0000000..cf7d157 --- /dev/null +++ b/lib/view/home.dart @@ -0,0 +1,82 @@ +import 'package:flutter/material.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:leg_barkr_app/service/auth_service.dart'; +import 'package:leg_barkr_app/view/metrics/metrics_page.dart'; +import 'package:leg_barkr_app/view/steps/steps_page.dart'; +import 'package:leg_barkr_app/view/map/map_page.dart'; +import 'package:leg_barkr_app/view/settings/settings_page.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class HomeScreen extends StatefulWidget { + const HomeScreen({Key? key}) : super(key: key); + + @override + _HomeScreenState createState() => _HomeScreenState(); +} + +class _HomeScreenState extends State { + int _page = 0; + PageController _pageController = PageController(); + + _HomeScreenState() { + FirebaseAuth.instance + .authStateChanges() + .listen((User? user) async { + if (user == null) { + Navigator.pushNamed(context, "/login"); + } else { + final prefs = await SharedPreferences.getInstance(); + //final String token = await user.getIdToken(); + final List userDevices = await AuthService().getUserDevices(user.uid); + prefs.setStringList("devices", userDevices); + prefs.setString("current_device", userDevices[0]); + } + }); + } + + void onBottomBarPressed(int page) { + setState(() { + _page = page; + }); + _pageController.jumpToPage(page); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: PageView( + controller: _pageController, + children: const [ + MetricsPage(), + StepsPage(), + MapPage(), + //SettingsPage() + ], + onPageChanged: (page) { + setState(() { + _page = page; + }); + }, + ), + bottomNavigationBar: BottomNavigationBar( + items: const [ + BottomNavigationBarItem(icon: Icon(Icons.data_usage), label: 'Home'), + BottomNavigationBarItem(icon: Icon(Icons.pets), label: 'Steps'), + BottomNavigationBarItem(icon: Icon(Icons.location_on_outlined), label: 'Location'), + BottomNavigationBarItem(icon: Icon(Icons.settings), label: 'Settings'), + ], + currentIndex: _page, + selectedItemColor: Colors.green, + unselectedItemColor: Colors.black, + showSelectedLabels: true, + showUnselectedLabels: false, + backgroundColor: Colors.white, + onTap: onBottomBarPressed, + type: BottomNavigationBarType.fixed, + ) + ); + } +} + + diff --git a/lib/view/map/map_page.dart b/lib/view/map/map_page.dart new file mode 100644 index 0000000..eafd7f6 --- /dev/null +++ b/lib/view/map/map_page.dart @@ -0,0 +1,60 @@ +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:leg_barkr_app/service/map_service.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class MapPage extends StatefulWidget { + const MapPage({ Key? key }) : super(key: key); + + @override + _MapPageState createState() => _MapPageState(); +} + +class _MapPageState extends State { + late GoogleMapController _mapController; + final Map _markers = {}; + + Future _onMapCreated(GoogleMapController controller) async { + _mapController = controller; + final prefs = await SharedPreferences.getInstance(); + final user = await FirebaseAuth.instance.currentUser!; + final String token = await user.getIdToken(); + final String deviceId = prefs.getString("current_device") ?? ""; + final lastLocation = await MapService().getPetLastLocation(deviceId, token); + final myLocation = await MapService().getMyLocation(); + + setState(() { + _markers.clear(); + final petMarker = Marker( + markerId: MarkerId("pet_location"), + position: LatLng(lastLocation.latitude, lastLocation.longitude), + infoWindow: InfoWindow(title: "Pet location")); + + final myMarker = Marker( + markerId: MarkerId("my_location"), + position: LatLng(myLocation.latitude, myLocation.longitude), + infoWindow: InfoWindow(title: "My location")); + + _markers["pet_location"] = petMarker; + _markers["my_location"] = myMarker; + _mapController.animateCamera(CameraUpdate.newLatLng(LatLng(myLocation.latitude, myLocation.longitude))); + }); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + body: GoogleMap( + onMapCreated: _onMapCreated, + initialCameraPosition: CameraPosition( + target: LatLng(51.5, -0.12), + zoom: 12.0, + ), + markers: _markers.values.toSet(), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/view/metrics/metrics_now.dart b/lib/view/metrics/metrics_now.dart new file mode 100644 index 0000000..fa2c0e5 --- /dev/null +++ b/lib/view/metrics/metrics_now.dart @@ -0,0 +1,102 @@ +import 'package:flutter/material.dart'; +import 'package:leg_barkr_app/model/metrics_data.dart'; +import 'package:syncfusion_flutter_gauges/gauges.dart'; + +class MetricsNow extends StatelessWidget { + MetricsData data; + Color textColor; + bool showGauge; + + MetricsNow(this.data, this.textColor, this.showGauge); + + @override + Widget build(BuildContext context) { + if (showGauge) { + return SizedBox( + height: 150, + width: 150, + child: SfRadialGauge( + axes: [ + RadialAxis( + minimum: data.minimumPossible, + maximum: data.maximumPossible, + ranges: [ + GaugeRange( + startValue: data.minimumPossible, + endValue: data.lowCutOff, + color: Colors.blue, + startWidth: 10, + endWidth: 10 + ), + GaugeRange( + startValue: data.lowCutOff, + endValue: data.highCutOff, + color: textColor, + startWidth: 10, + endWidth: 10 + ), + GaugeRange( + startValue: data.highCutOff, + endValue: data.maximumPossible, + color: Colors.red, + startWidth: 10, + endWidth: 10 + ) + ], + pointers: [ + MarkerPointer( + value: data.currentReading, + color: Colors.black, + markerWidth: 20 + ) + ], + annotations: [ + GaugeAnnotation( + angle: 90, + positionFactor: 0.75, + widget: Column( + children: [ + Text(data.currentReading.toString(), + style: TextStyle(fontSize: 26, + color: textColor, + fontWeight: FontWeight.bold)), + Text(data.units, style: TextStyle(fontSize: 16, + color: textColor, + fontWeight: FontWeight.bold)), + ], + ) + ) + ] + ) + ] + ) + ); + } else { + return ElevatedButton( + onPressed: () {}, + child:Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text(data.currentReading.toString(), + style: TextStyle(fontSize: 32, + color: textColor, + fontWeight: FontWeight.bold)), + Text(data.units, style: TextStyle(fontSize: 18, + color: textColor, + fontWeight: FontWeight.bold)), + ], + ), + style: ElevatedButton.styleFrom( + alignment: Alignment.center, + side: BorderSide(width: 15.0, color: textColor), + shape: CircleBorder(), + padding: EdgeInsets.all(25), + primary: Colors.green, + minimumSize: Size(150, 150), + maximumSize: Size(150, 150) + ), + ); + } + } +} \ No newline at end of file diff --git a/lib/view/metrics/metrics_page.dart b/lib/view/metrics/metrics_page.dart new file mode 100644 index 0000000..335d200 --- /dev/null +++ b/lib/view/metrics/metrics_page.dart @@ -0,0 +1,78 @@ +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; +import 'package:leg_barkr_app/model/metrics_data.dart'; +import 'package:leg_barkr_app/model/metrics_response.dart'; +import 'package:leg_barkr_app/model/temp_series.dart'; +import 'package:leg_barkr_app/service/metrics_service.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'metrics_row.dart'; +import 'temp_chart.dart'; +import 'package:leg_barkr_app/utils/constants.dart' as Constants; + +class MetricsPage extends StatefulWidget { + const MetricsPage({ Key? key }) : super(key: key); + + @override + _MetricsPageState createState() => _MetricsPageState(); +} + +class _MetricsPageState extends State { + // Dummy data, will be removed + /* + final List data = [ + TempSeries(DateTime.parse('2022-02-09 20:00:00Z'), 38.4), + TempSeries(DateTime.parse('2022-02-09 19:30:00Z'), 38.8), + TempSeries(DateTime.parse('2022-02-09 19:00:00Z'), 38.2), + TempSeries(DateTime.parse('2022-02-09 18:30:00Z'), 39.2), + TempSeries(DateTime.parse('2022-02-09 18:00:00Z'), 39.5), + TempSeries(DateTime.parse('2022-02-09 17:30:00Z'), 37.8) + ]; + */ + + Future onMetricsReceived() async{ + final prefs = await SharedPreferences.getInstance(); + final String deviceId = prefs.getString("current_device") ?? ""; + final user = await FirebaseAuth.instance.currentUser!; + final String token = await user.getIdToken(); + return await MetricsService().getMetricsSummary(deviceId, token); + } + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0), + child: FutureBuilder( + future: onMetricsReceived(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + MetricsResponse metricsResponse; + if (snapshot.hasData){ + metricsResponse = snapshot.data; + } else { + metricsResponse = MetricsResponse(0, 0, 0, 0, 0, 0, 0, 0, 0); + } + + return ListView( + padding: EdgeInsets.all(5.0), + children: [ + Text("Today's summary", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 36, fontWeight: FontWeight.bold)), + + MetricsRow(new MetricsData(metricsResponse.lastSkinTemp, metricsResponse.minSkinTemp, metricsResponse.maxSkinTemp, Constants.MIN_SKIN_TEMP, Constants.MAX_SKIN_TEMP, Constants.LOW_SKIN_TEMP_DOG, Constants.HIGH_SKIN_TEMP_DOG, "Skin temperature", "°C"), Colors.white, Colors.green, true), + MetricsRow(new MetricsData(metricsResponse.lastHumidity, metricsResponse.minHumidity, metricsResponse.maxHumidity, Constants.MIN_HUMIDITY, Constants.MAX_HUMIDITY, Constants.LOW_HUMIDITY_DOG, Constants.HIGH_HUMIDITY_DOG, "Humidity", "%"), Colors.green, Colors.black, false), + MetricsRow(new MetricsData(metricsResponse.lastAirTemp, metricsResponse.minAirTemp, metricsResponse.maxAirTemp, Constants.MIN_AIR_TEMP, Constants.MAX_AIR_TEMP, Constants.LOW_AIR_TEMP_DOG, Constants.HIGH_AIR_TEMP_DOG, "Air temperature", "°C"), Colors.white, Colors.green, true), + + /* + Padding( + padding: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 0.0), + child: Text("Today's temperature", textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 36, fontWeight: FontWeight.bold)), + ), + */ + + //TempChart(data) + + ] + ); + } + ) + ); + } +} \ No newline at end of file diff --git a/lib/view/metrics/metrics_row.dart b/lib/view/metrics/metrics_row.dart new file mode 100644 index 0000000..b7c4c98 --- /dev/null +++ b/lib/view/metrics/metrics_row.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; +import 'package:leg_barkr_app/model/metrics_data.dart'; +import 'metrics_now.dart'; +import 'metrics_summary.dart'; + +class MetricsRow extends StatelessWidget { + MetricsData data; + Color backgroundColour; + Color textColour; + bool showGauge; + + MetricsRow(this.data, this.backgroundColour, this.textColour, this.showGauge); + + @override + Widget build(BuildContext context) { + return Card( + elevation: 10, + shadowColor: Colors.black, + color: backgroundColour, + child: Padding( + padding: EdgeInsets.all(5.0), + child: Row( + children: [ + MetricsNow(data, textColour, showGauge), + MetricsSummary(data, textColour) + ], + ), + ), + ); + } + +} \ No newline at end of file diff --git a/lib/view/metrics/metrics_summary.dart b/lib/view/metrics/metrics_summary.dart new file mode 100644 index 0000000..01af53b --- /dev/null +++ b/lib/view/metrics/metrics_summary.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import 'package:leg_barkr_app/model/metrics_data.dart'; + +class MetricsSummary extends StatelessWidget { + MetricsData data; + Color textColour; + + MetricsSummary(this.data, this.textColour); + + @override + Widget build(BuildContext context) { + Row metricMinMax = Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.fromLTRB(0.0, 10.0, 5.0, 10.0), + child: Text("Minimum\n" + data.lowestReading.toString() + " " + data.units, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.bold)) + ), + Padding( + padding: EdgeInsets.fromLTRB(5.0, 10.0, 0.0, 10.0), + child: Text("Maximum\n" + data.highestReading.toString() + " " + data.units, textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontSize: 16, fontWeight: FontWeight.bold)) + ) + ], + ); + + return Expanded( + child: Padding( + padding: EdgeInsets.all(15.0), + child: Center( + child: Column( + children: [ + Text(data.metric, textAlign: TextAlign.center, style: TextStyle(color: textColour, fontSize: 24, fontWeight: FontWeight.bold)), + metricMinMax + ], + ) + ) + ) + ); + } +} \ No newline at end of file diff --git a/lib/view/metrics/temp_chart.dart b/lib/view/metrics/temp_chart.dart new file mode 100644 index 0000000..37e2d17 --- /dev/null +++ b/lib/view/metrics/temp_chart.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:leg_barkr_app/model/temp_series.dart'; +import 'package:leg_barkr_app/utils/constants.dart' as Constants; + +class TempChart extends StatelessWidget { + List tempData; + + TempChart(this.tempData); + + @override + Widget build(BuildContext context) { + List> series = [ + charts.Series( + id: "Temperature", + data: tempData, + domainFn: (TempSeries series, _) => series.date, + measureFn: (TempSeries series, _) => series.temperature, + colorFn: (TempSeries series, _) => charts.ColorUtil.fromDartColor(Colors.green) + ) + ]; + + return Container( + height: 600, + width: double.infinity, + child: charts.TimeSeriesChart( + series, + animate: true, + primaryMeasureAxis: const charts.NumericAxisSpec( + tickProviderSpec: charts.BasicNumericTickProviderSpec(zeroBound: false), + viewport: charts.NumericExtents(Constants.MIN_SKIN_TEMP, Constants.MAX_SKIN_TEMP), + ),) + ); + } + +} \ No newline at end of file diff --git a/lib/view/settings/settings_page.dart b/lib/view/settings/settings_page.dart new file mode 100644 index 0000000..62c3525 --- /dev/null +++ b/lib/view/settings/settings_page.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class SettingsPage extends StatelessWidget { + const SettingsPage({ Key? key }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Text("Settings Page"); + } +} \ No newline at end of file diff --git a/lib/view/steps/steps_chart.dart b/lib/view/steps/steps_chart.dart new file mode 100644 index 0000000..ecb35e1 --- /dev/null +++ b/lib/view/steps/steps_chart.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:leg_barkr_app/model/steps_series.dart'; + +class StepsChart extends StatelessWidget { + List data; + + StepsChart(this.data); + + @override + Widget build(BuildContext context) { + List> series = [ + charts.Series( + id: "Steps", + data: data, + domainFn: (StepsSeries series, _) => series.date.day.toString() + "/" + series.date.month.toString(), + measureFn: (StepsSeries series, _) => series.steps, + colorFn: (StepsSeries series, _) => charts.ColorUtil.fromDartColor(Colors.green) + ) + ]; + + return Container( + height: 600, + width: double.infinity, + child: charts.BarChart(series, animate: true) + ); + } + +} \ No newline at end of file diff --git a/lib/view/steps/steps_page.dart b/lib/view/steps/steps_page.dart new file mode 100644 index 0000000..6dc4d4b --- /dev/null +++ b/lib/view/steps/steps_page.dart @@ -0,0 +1,55 @@ +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; +import 'package:leg_barkr_app/model/steps_series.dart'; +import 'package:leg_barkr_app/service/steps_service.dart'; +import 'package:leg_barkr_app/view/steps/steps_chart.dart'; +import 'package:leg_barkr_app/view/steps/steps_today.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class StepsPage extends StatefulWidget { + const StepsPage({ Key? key }) : super(key: key); + + @override + _StepsPageState createState() => _StepsPageState(); +} + +class _StepsPageState extends State { + + Future> onStepsRetrieved() async{ + final prefs = await SharedPreferences.getInstance(); + final String deviceId = prefs.getString("current_device") ?? ""; + final user = await FirebaseAuth.instance.currentUser!; + final String token = await user.getIdToken(); + return await StepsService().getStepsLastFiveDays(deviceId, token); + } + + @override + Widget build(BuildContext context) { + return Padding( + padding: EdgeInsets.fromLTRB(0.0, 50.0, 10.0, 0.0), + child: FutureBuilder( + future: onStepsRetrieved(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + int stepsToday = 0; + List stepsSeries = []; + if(snapshot.hasData) { + List stepsLastFiveDays = snapshot.data; + stepsToday = stepsLastFiveDays[0]; + for(int i = 0; i < stepsLastFiveDays.length; i++){ + DateTime now = DateTime.now(); + stepsSeries.add(StepsSeries(DateTime(now.year, now.month, now.day-i), stepsLastFiveDays[i])); + } + stepsSeries = List.from(stepsSeries.reversed); + } + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + StepsToday(stepsToday), + new Expanded(child: StepsChart(stepsSeries)) + ], + ); + }, + ) + ); + } +} \ No newline at end of file diff --git a/lib/view/steps/steps_today.dart b/lib/view/steps/steps_today.dart new file mode 100644 index 0000000..e00150c --- /dev/null +++ b/lib/view/steps/steps_today.dart @@ -0,0 +1,22 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +class StepsToday extends StatelessWidget { + int count; + + StepsToday(this.count); + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + Text("Steps today", style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 20), textAlign: TextAlign.center), + Text(count.toString(), style: TextStyle(color: Colors.green, fontWeight: FontWeight.bold, fontSize: 40), textAlign: TextAlign.center) + ], + ) + ); + } + +} \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..a6ad33b --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,684 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.dartlang.org" + source: hosted + version: "34.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.0" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.8.2" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + build: + dependency: transitive + description: + name: build + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" + build_config: + dependency: transitive + description: + name: build_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" + charts_common: + dependency: transitive + description: + name: charts_common + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.0" + charts_flutter: + dependency: "direct main" + description: + name: charts_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.5" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.1" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.2" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.7" + firebase_auth_platform_interface: + dependency: transitive + description: + name: firebase_auth_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.11" + firebase_auth_web: + dependency: transitive + description: + name: firebase_auth_web + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.7" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + url: "https://pub.dartlang.org" + source: hosted + version: "1.12.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.4" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.4" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.5" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + geocoding: + dependency: "direct main" + description: + name: geocoding + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + geocoding_platform_interface: + dependency: transitive + description: + name: geocoding_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + geolocator: + dependency: "direct main" + description: + name: geolocator + url: "https://pub.dartlang.org" + source: hosted + version: "8.2.0" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1+1" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.3" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + google_maps: + dependency: transitive + description: + name: google_maps + url: "https://pub.dartlang.org" + source: hosted + version: "5.3.0" + google_maps_flutter: + dependency: "direct main" + description: + name: google_maps_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + google_maps_flutter_platform_interface: + dependency: transitive + description: + name: google_maps_flutter_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + google_maps_flutter_web: + dependency: "direct main" + description: + name: google_maps_flutter_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2+1" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.15.0" + http: + dependency: "direct main" + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.4" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" + intl: + dependency: transitive + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.3" + js_wrapping: + dependency: transitive + description: + name: js_wrapping + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.4" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "4.4.0" + json_serializable: + dependency: "direct main" + description: + name: json_serializable + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.4" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.0" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.5" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.11.1" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" + process: + dependency: transitive + description: + name: process + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.4" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.13" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + shared_preferences_ios: + dependency: transitive + description: + name: shared_preferences_ios + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.10" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + source_helper: + dependency: transitive + description: + name: source_helper + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + stream_transform: + dependency: transitive + description: + name: stream_transform + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + syncfusion_flutter_core: + dependency: transitive + description: + name: syncfusion_flutter_core + url: "https://pub.dartlang.org" + source: hosted + version: "19.4.50" + syncfusion_flutter_gauges: + dependency: "direct main" + description: + name: syncfusion_flutter_gauges + url: "https://pub.dartlang.org" + source: hosted + version: "19.4.50" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.8" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0+1" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" +sdks: + dart: ">=2.16.0 <3.0.0" + flutter: ">=2.8.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..afb9505 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,101 @@ +name: leg_barkr_app +description: The user app for the 1st coursework of Embedded Systems + +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 + +environment: + sdk: ">=2.16.0 <3.0.0" + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + google_maps_flutter: ^2.1.1 + google_maps_flutter_web: ^0.3.2+1 + charts_flutter: ^0.12.0 + syncfusion_flutter_gauges: ^19.4.50 + http: ^0.13.4 + firebase_core: ^1.12.0 + firebase_auth: ^3.3.7 + json_serializable: ^6.1.4 + geocoding: ^2.0.2 + geolocator: ^8.2.0 + shared_preferences: ^2.0.13 + + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^1.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..aea54be --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:leg_barkr_app/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const Main()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +}