initial commit
46
.gitignore
vendored
Normal file
@ -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
|
BIN
.gradle/6.1.1/executionHistory/executionHistory.lock
Normal file
BIN
.gradle/6.1.1/fileChanges/last-build.bin
Normal file
BIN
.gradle/6.1.1/fileHashes/fileHashes.lock
Normal file
0
.gradle/6.1.1/gc.properties
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
2
.gradle/buildOutputCleanup/cache.properties
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#Mon Sep 20 23:44:21 CEST 2021
|
||||||
|
gradle.version=6.1.1
|
BIN
.gradle/checksums/checksums.lock
Normal file
0
.gradle/vcs-1/gc.properties
Normal file
10
.metadata
Normal file
@ -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: a7fb06d6faa2f0ad0da124c79a4eb26ae091baa5
|
||||||
|
channel: beta
|
||||||
|
|
||||||
|
project_type: app
|
16
README.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# tide
|
||||||
|
|
||||||
|
A new Flutter project.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
This project is a starting point for a Flutter application.
|
||||||
|
|
||||||
|
A few resources to get you started if this is your first Flutter project:
|
||||||
|
|
||||||
|
- [Lab: Write your first Flutter app](https://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.
|
29
analysis_options.yaml
Normal file
@ -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
|
13
android/.gitignore
vendored
Normal file
@ -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
|
68
android/app/build.gradle
Normal file
@ -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 30
|
||||||
|
|
||||||
|
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.example.diameter"
|
||||||
|
minSdkVersion 16
|
||||||
|
targetSdkVersion 30
|
||||||
|
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"
|
||||||
|
}
|
7
android/app/src/debug/AndroidManifest.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.example.diameter">
|
||||||
|
<!-- Flutter needs it to communicate with the running application
|
||||||
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
|
-->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
</manifest>
|
32
android/app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.example.diameter">
|
||||||
|
<application
|
||||||
|
android:label="diameter"
|
||||||
|
android:icon="@mipmap/ic_launcher">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/LaunchTheme"
|
||||||
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
|
android:windowSoftInputMode="adjustResize">
|
||||||
|
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||||
|
the Android process has started. This theme is visible to the user
|
||||||
|
while the Flutter UI initializes. After that, this theme continues
|
||||||
|
to determine the Window background behind the Flutter UI. -->
|
||||||
|
<meta-data
|
||||||
|
android:name="io.flutter.embedding.android.NormalTheme"
|
||||||
|
android:resource="@style/NormalTheme"
|
||||||
|
/>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<!-- Don't delete the meta-data below.
|
||||||
|
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||||
|
<meta-data
|
||||||
|
android:name="flutterEmbedding"
|
||||||
|
android:value="2" />
|
||||||
|
</application>
|
||||||
|
</manifest>
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.example.diameter
|
||||||
|
|
||||||
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
||||||
|
class MainActivity: FlutterActivity() {
|
||||||
|
}
|
12
android/app/src/main/res/drawable-v21/launch_background.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Modify this file to customize your launch splash screen -->
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="?android:colorBackground" />
|
||||||
|
|
||||||
|
<!-- You can insert your own image assets here -->
|
||||||
|
<!-- <item>
|
||||||
|
<bitmap
|
||||||
|
android:gravity="center"
|
||||||
|
android:src="@mipmap/launch_image" />
|
||||||
|
</item> -->
|
||||||
|
</layer-list>
|
12
android/app/src/main/res/drawable/launch_background.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Modify this file to customize your launch splash screen -->
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@android:color/white" />
|
||||||
|
|
||||||
|
<!-- You can insert your own image assets here -->
|
||||||
|
<!-- <item>
|
||||||
|
<bitmap
|
||||||
|
android:gravity="center"
|
||||||
|
android:src="@mipmap/launch_image" />
|
||||||
|
</item> -->
|
||||||
|
</layer-list>
|
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 544 B |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 721 B |
BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
18
android/app/src/main/res/values-night/styles.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
|
Flutter draws its first frame -->
|
||||||
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
|
</style>
|
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
|
This theme determines the color of the Android Window while your
|
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||||
|
running.
|
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
18
android/app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
|
Flutter draws its first frame -->
|
||||||
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
|
</style>
|
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
|
This theme determines the color of the Android Window while your
|
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||||
|
running.
|
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
7
android/app/src/profile/AndroidManifest.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.example.diameter">
|
||||||
|
<!-- Flutter needs it to communicate with the running application
|
||||||
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
|
-->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
</manifest>
|
29
android/build.gradle
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
buildscript {
|
||||||
|
ext.kotlin_version = '1.3.50'
|
||||||
|
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}"
|
||||||
|
project.evaluationDependsOn(':app')
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
3
android/gradle.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
org.gradle.jvmargs=-Xmx1536M
|
||||||
|
android.useAndroidX=true
|
||||||
|
android.enableJetifier=true
|
6
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -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
|
11
android/settings.gradle
Normal file
@ -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"
|
BIN
assets/fonts/RobotoCondensed-Bold.ttf
Normal file
BIN
assets/fonts/RobotoCondensed-BoldItalic.ttf
Normal file
BIN
assets/fonts/RobotoCondensed-Italic.ttf
Normal file
BIN
assets/fonts/RobotoCondensed-Light.ttf
Normal file
BIN
assets/fonts/RobotoCondensed-LightItalic.ttf
Normal file
BIN
assets/fonts/RobotoCondensed-Regular.ttf
Normal file
33
ios/.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
*.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
|
26
ios/Flutter/AppFrameworkInfo.plist
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>App</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>io.flutter.flutter.app</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>App</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>9.0</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
1
ios/Flutter/Debug.xcconfig
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "Generated.xcconfig"
|
1
ios/Flutter/Release.xcconfig
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "Generated.xcconfig"
|
471
ios/Runner.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,471 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 46;
|
||||||
|
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 = "<group>"; };
|
||||||
|
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
|
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
|
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||||
|
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||||
|
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||||
|
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 = "<group>"; };
|
||||||
|
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
|
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||||
|
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
/* 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 = "<group>";
|
||||||
|
};
|
||||||
|
97C146E51CF9000F007C117D = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
9740EEB11CF90186004384FC /* Flutter */,
|
||||||
|
97C146F01CF9000F007C117D /* Runner */,
|
||||||
|
97C146EF1CF9000F007C117D /* Products */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
97C146EF1CF9000F007C117D /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
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 = "<group>";
|
||||||
|
};
|
||||||
|
/* 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 = 1020;
|
||||||
|
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 = "<group>";
|
||||||
|
};
|
||||||
|
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
97C147001CF9000F007C117D /* Base */,
|
||||||
|
);
|
||||||
|
name = LaunchScreen.storyboard;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* 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.example.tide;
|
||||||
|
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_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||||
|
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.example.tide;
|
||||||
|
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.example.tide;
|
||||||
|
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 */;
|
||||||
|
}
|
7
ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Workspace
|
||||||
|
version = "1.0">
|
||||||
|
<FileRef
|
||||||
|
location = "self:">
|
||||||
|
</FileRef>
|
||||||
|
</Workspace>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>PreviewsEnabled</key>
|
||||||
|
<false/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
91
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "1020"
|
||||||
|
version = "1.3">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
|
<Testables>
|
||||||
|
</Testables>
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
|
<AdditionalOptions>
|
||||||
|
</AdditionalOptions>
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
<AdditionalOptions>
|
||||||
|
</AdditionalOptions>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Profile"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
|
||||||
|
BuildableName = "Runner.app"
|
||||||
|
BlueprintName = "Runner"
|
||||||
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
7
ios/Runner.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Workspace
|
||||||
|
version = "1.0">
|
||||||
|
<FileRef
|
||||||
|
location = "group:Runner.xcodeproj">
|
||||||
|
</FileRef>
|
||||||
|
</Workspace>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>PreviewsEnabled</key>
|
||||||
|
<false/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
13
ios/Runner/AppDelegate.swift
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import UIKit
|
||||||
|
import Flutter
|
||||||
|
|
||||||
|
@UIApplicationMain
|
||||||
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
|
override func application(
|
||||||
|
_ application: UIApplication,
|
||||||
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
|
) -> Bool {
|
||||||
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
|
}
|
||||||
|
}
|
122
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 564 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.5 KiB |
23
ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
vendored
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
vendored
Normal file
After Width: | Height: | Size: 68 B |
BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
vendored
Normal file
After Width: | Height: | Size: 68 B |
BIN
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
vendored
Normal file
After Width: | Height: | Size: 68 B |
5
ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
vendored
Normal file
@ -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.
|
37
ios/Runner/Base.lproj/LaunchScreen.storyboard
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="EHf-IW-A2E">
|
||||||
|
<objects>
|
||||||
|
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||||
|
<layoutGuides>
|
||||||
|
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||||
|
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||||
|
</layoutGuides>
|
||||||
|
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||||
|
</imageView>
|
||||||
|
</subviews>
|
||||||
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||||
|
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||||
|
</constraints>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="53" y="375"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
<resources>
|
||||||
|
<image name="LaunchImage" width="168" height="185"/>
|
||||||
|
</resources>
|
||||||
|
</document>
|
26
ios/Runner/Base.lproj/Main.storyboard
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||||
|
<dependencies>
|
||||||
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--Flutter View Controller-->
|
||||||
|
<scene sceneID="tne-QT-ifu">
|
||||||
|
<objects>
|
||||||
|
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||||
|
<layoutGuides>
|
||||||
|
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||||
|
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||||
|
</layoutGuides>
|
||||||
|
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||||
|
</view>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
45
ios/Runner/Info.plist
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>tide</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
<true/>
|
||||||
|
<key>UILaunchStoryboardName</key>
|
||||||
|
<string>LaunchScreen</string>
|
||||||
|
<key>UIMainStoryboardFile</key>
|
||||||
|
<string>Main</string>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
|
<false/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
1
ios/Runner/Runner-Bridging-Header.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#import "GeneratedPluginRegistrant.h"
|
23
lib/components/app_theme.dart
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import 'package:flex_color_scheme/flex_color_scheme.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AppTheme {
|
||||||
|
AppTheme._();
|
||||||
|
|
||||||
|
static ThemeData lightTheme = FlexColorScheme.light(
|
||||||
|
scheme: FlexScheme.mandyRed,
|
||||||
|
fontFamily: 'RobotoCondensed',
|
||||||
|
).toTheme;
|
||||||
|
|
||||||
|
static ThemeData darkTheme = FlexColorScheme.light(
|
||||||
|
scheme: FlexScheme.mandyRed,
|
||||||
|
fontFamily: 'RobotoCondensed',
|
||||||
|
).toTheme;
|
||||||
|
|
||||||
|
static ThemeData makeTheme(ThemeData baseThemeData) {
|
||||||
|
return baseThemeData.copyWith(
|
||||||
|
visualDensity: VisualDensity.compact,
|
||||||
|
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||||
|
backgroundColor: baseThemeData.primaryColor));
|
||||||
|
}
|
||||||
|
}
|
43
lib/components/data_table.dart
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
abstract class DataTableContent {
|
||||||
|
bool selected = false;
|
||||||
|
List<DataCell> asDataTableCells(List<Widget> actions) => [];
|
||||||
|
static List<DataColumn> asDataTableColumns() => [];
|
||||||
|
}
|
||||||
|
|
||||||
|
class DataTableSourceBuilder extends DataTableSource {
|
||||||
|
final List<DataTableContent> data;
|
||||||
|
final BuildContext context;
|
||||||
|
|
||||||
|
DataTableSourceBuilder(this.context, this.data);
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get isRowCountApproximate => false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get rowCount => data.length;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get selectedRowCount {
|
||||||
|
int count = 0;
|
||||||
|
for (var element in data) {
|
||||||
|
if (element.selected) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
DataRow? getRow(int index) {
|
||||||
|
assert(index >= 0);
|
||||||
|
if (index >= data.length) return null;
|
||||||
|
final rowData = data[index];
|
||||||
|
return DataRow.byIndex(
|
||||||
|
index: index,
|
||||||
|
selected: rowData.selected,
|
||||||
|
cells: rowData.asDataTableCells([]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
45
lib/components/detail.dart
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class DetailBottomRow extends StatefulWidget {
|
||||||
|
final void Function() onCancel;
|
||||||
|
final void Function() onSave;
|
||||||
|
|
||||||
|
const DetailBottomRow(
|
||||||
|
{Key? key, required this.onCancel, required this.onSave})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_DetailBottomRowState createState() => _DetailBottomRowState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DetailBottomRowState<T> extends State<DetailBottomRow> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BottomAppBar(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
ElevatedButton.icon(
|
||||||
|
onPressed: widget.onCancel,
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.close,
|
||||||
|
size: 18.0,
|
||||||
|
),
|
||||||
|
label: const Text('CANCEL'),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
ElevatedButton.icon(
|
||||||
|
onPressed: widget.onSave,
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.save,
|
||||||
|
size: 18.0,
|
||||||
|
),
|
||||||
|
label: const Text('SAVE'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
79
lib/components/dialogs.dart
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class Dialogs {
|
||||||
|
static void showCancelConfirmationDialog(
|
||||||
|
{required BuildContext context,
|
||||||
|
required bool isNew,
|
||||||
|
required void Function() onSave,
|
||||||
|
String? message,
|
||||||
|
void Function(BuildContext context)? onDiscard}) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
List<Widget> actions = [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context, 'CANCEL'),
|
||||||
|
child: const Text('CANCEL'),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
actions.add(isNew
|
||||||
|
? ElevatedButton(
|
||||||
|
onPressed: () => Navigator.pop(context, 'DISCARD'),
|
||||||
|
child: const Text('DISCARD'),
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context, 'DISCARD'),
|
||||||
|
child: const Text('DISCARD'),
|
||||||
|
));
|
||||||
|
|
||||||
|
if (!isNew) {
|
||||||
|
actions.add(ElevatedButton(
|
||||||
|
onPressed: () => Navigator.pop(context, 'SAVE'),
|
||||||
|
child: const Text('SAVE'),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return AlertDialog(
|
||||||
|
content: Text(message ??
|
||||||
|
'You already made some changes. Discard your input?'),
|
||||||
|
actions: actions,
|
||||||
|
);
|
||||||
|
}).then((value) {
|
||||||
|
if (value == 'DISCARD') {
|
||||||
|
onDiscard != null ? onDiscard(context) : Navigator.pop(context);
|
||||||
|
}
|
||||||
|
if (value == 'SAVE') {
|
||||||
|
onSave();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static void showConfirmationDialog(
|
||||||
|
{required BuildContext context,
|
||||||
|
required void Function() onConfirm,
|
||||||
|
String message = 'Are you sure you want to delete this record?',
|
||||||
|
String confirmationLabel = 'DELETE'}) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
content: Text(message),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context, 'CANCEL'),
|
||||||
|
child: const Text('CANCEL'),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () => Navigator.pop(context, 'CONFIRM'),
|
||||||
|
child: Text(confirmationLabel),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).then((value) {
|
||||||
|
if (value == 'CONFIRM') {
|
||||||
|
onConfirm();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
222
lib/components/forms.dart
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
import 'package:diameter/components/progress_indicator.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class StyledForm extends StatefulWidget {
|
||||||
|
final List<Widget>? fields;
|
||||||
|
final List<Widget>? buttons;
|
||||||
|
final GlobalKey<FormState>? formState;
|
||||||
|
|
||||||
|
const StyledForm({Key? key, this.formState, this.fields, this.buttons})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_StyledFormState createState() => _StyledFormState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StyledFormState extends State<StyledForm> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: Form(
|
||||||
|
key: widget.formState,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
children: widget.fields
|
||||||
|
?.map((e) => Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 5.0),
|
||||||
|
child: e))
|
||||||
|
.toList() ??
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: widget.buttons ?? [],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StyledBooleanFormField extends StatefulWidget {
|
||||||
|
final bool value;
|
||||||
|
final String label;
|
||||||
|
final void Function(bool) onChanged;
|
||||||
|
final bool? enabled;
|
||||||
|
|
||||||
|
const StyledBooleanFormField(
|
||||||
|
{Key? key,
|
||||||
|
required this.value,
|
||||||
|
required this.label,
|
||||||
|
required this.onChanged,
|
||||||
|
this.enabled})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_StyledBooleanFormFieldState createState() => _StyledBooleanFormFieldState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StyledBooleanFormFieldState extends State<StyledBooleanFormField> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FormField<bool>(builder: (context) {
|
||||||
|
return ListTile(
|
||||||
|
onTap: () => widget.onChanged(!widget.value),
|
||||||
|
trailing: Switch(
|
||||||
|
value: widget.value,
|
||||||
|
onChanged: widget.onChanged,
|
||||||
|
),
|
||||||
|
title: Text(widget.label),
|
||||||
|
enabled: widget.enabled ?? true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StyledTimeOfDayFormField extends StatefulWidget {
|
||||||
|
final TimeOfDay time;
|
||||||
|
final TextEditingController controller;
|
||||||
|
final String label;
|
||||||
|
final void Function(TimeOfDay?) onChanged;
|
||||||
|
|
||||||
|
const StyledTimeOfDayFormField(
|
||||||
|
{Key? key,
|
||||||
|
required this.time,
|
||||||
|
required this.controller,
|
||||||
|
required this.label,
|
||||||
|
required this.onChanged})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_StyledTimeOfDayFormFieldState createState() =>
|
||||||
|
_StyledTimeOfDayFormFieldState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StyledTimeOfDayFormFieldState extends State<StyledTimeOfDayFormField> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return TextFormField(
|
||||||
|
readOnly: true,
|
||||||
|
controller: widget.controller,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: widget.label,
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
final newTime = await showTimePicker(
|
||||||
|
context: context,
|
||||||
|
initialTime: widget.time,
|
||||||
|
);
|
||||||
|
widget.onChanged(newTime);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StyledDropdownButton<T> extends StatefulWidget {
|
||||||
|
final String label;
|
||||||
|
final T? selectedItem;
|
||||||
|
final List<T> items;
|
||||||
|
final Widget Function(T item) renderItem;
|
||||||
|
final void Function(T? value) onChanged;
|
||||||
|
|
||||||
|
const StyledDropdownButton(
|
||||||
|
{Key? key,
|
||||||
|
this.selectedItem,
|
||||||
|
required this.label,
|
||||||
|
required this.items,
|
||||||
|
required this.renderItem,
|
||||||
|
required this.onChanged})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_StyledDropdownButtonState<T> createState() => _StyledDropdownButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StyledDropdownButtonState<T> extends State<StyledDropdownButton<T>> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return DropdownButtonFormField<T>(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: widget.label,
|
||||||
|
),
|
||||||
|
value: widget.selectedItem,
|
||||||
|
onChanged: widget.onChanged,
|
||||||
|
items: widget.items
|
||||||
|
.map((item) => DropdownMenuItem<T>(
|
||||||
|
value: item,
|
||||||
|
child: widget.renderItem(item),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StyledFutureDropdownButton<T> extends StatefulWidget {
|
||||||
|
final String label;
|
||||||
|
final String? selectedItem;
|
||||||
|
final Future<List<T>> items;
|
||||||
|
final String? Function(T item) getItemValue;
|
||||||
|
final Widget Function(T item) renderItem;
|
||||||
|
final void Function(String? value) onChanged;
|
||||||
|
|
||||||
|
const StyledFutureDropdownButton(
|
||||||
|
{Key? key,
|
||||||
|
this.selectedItem,
|
||||||
|
required this.label,
|
||||||
|
required this.items,
|
||||||
|
required this.getItemValue,
|
||||||
|
required this.renderItem,
|
||||||
|
required this.onChanged})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_StyledFutureDropdownButtonState<T> createState() =>
|
||||||
|
_StyledFutureDropdownButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _StyledFutureDropdownButtonState<T>
|
||||||
|
extends State<StyledFutureDropdownButton<T>> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FutureBuilder<List<T>>(
|
||||||
|
future: widget.items,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return ViewWithProgressIndicator(
|
||||||
|
snapshot: snapshot,
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
progressIndicatorSize: 44,
|
||||||
|
child: snapshot.data == null || snapshot.data!.isEmpty
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(10.0),
|
||||||
|
child: Text('No Meal Sources'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: DropdownButtonFormField<String>(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: widget.label,
|
||||||
|
),
|
||||||
|
value: widget.selectedItem,
|
||||||
|
onChanged: widget.onChanged,
|
||||||
|
items: snapshot.data!
|
||||||
|
.map((item) => DropdownMenuItem<String>(
|
||||||
|
value: widget.getItemValue(item),
|
||||||
|
child: widget.renderItem(item),
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
55
lib/components/progress_indicator.dart
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
class ViewWithProgressIndicator extends StatefulWidget {
|
||||||
|
final AsyncSnapshot snapshot;
|
||||||
|
final Widget child;
|
||||||
|
final double progressIndicatorSize;
|
||||||
|
final EdgeInsets padding;
|
||||||
|
|
||||||
|
const ViewWithProgressIndicator(
|
||||||
|
{Key? key,
|
||||||
|
required this.snapshot,
|
||||||
|
required this.child,
|
||||||
|
this.progressIndicatorSize = 100,
|
||||||
|
this.padding = const EdgeInsets.all(0)})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ViewWithProgressIndicatorState createState() =>
|
||||||
|
_ViewWithProgressIndicatorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ViewWithProgressIndicatorState extends State<ViewWithProgressIndicator> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
switch (widget.snapshot.connectionState) {
|
||||||
|
case ConnectionState.none:
|
||||||
|
case ConnectionState.waiting:
|
||||||
|
return Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
padding: widget.padding,
|
||||||
|
child: Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: widget.progressIndicatorSize,
|
||||||
|
height: widget.progressIndicatorSize,
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
if (widget.snapshot.hasError) {
|
||||||
|
return Center(
|
||||||
|
child: Text(widget.snapshot.error.toString()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!widget.snapshot.hasData) {
|
||||||
|
return const Center(
|
||||||
|
child: Text("No data"),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return widget.child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
lib/config.dart
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import 'package:diameter/settings.dart';
|
||||||
|
|
||||||
|
const keyApplicationId = 'DFfD2aeppmqQnVmox02kUZhYOUc7vAtGfunAP7hn';
|
||||||
|
const keyClientKey = '0ROGEVQP0Id21EMEqK05wJP3nBDuOW5DM5Cpzdt3';
|
||||||
|
const keyParseServerUrl = 'https://parseapi.back4app.com';
|
||||||
|
|
||||||
|
// settings
|
||||||
|
NutritionMeasurement nutritionMeasurement = NutritionMeasurement.grams;
|
||||||
|
GlucoseMeasurement glucoseMeasurement = GlucoseMeasurement.mgPerDl;
|
||||||
|
GlucoseDisplayMode glucoseDisplayMode = GlucoseDisplayMode.bothForList;
|
||||||
|
|
||||||
|
DateTime dummyDate = DateTime(2000);
|
||||||
|
String dateFormat = 'MM/dd/yy';
|
||||||
|
String? longDateFormat = 'MMMM dd, yyyy';
|
||||||
|
String timeFormat = 'HH:mm';
|
||||||
|
String? longTimeFormat = 'HH:mm:ss';
|
||||||
|
|
||||||
|
bool showConfirmationDialogOnCancel = true;
|
||||||
|
bool showConfirmationDialogOnDelete = true;
|
||||||
|
bool showConfirmationDialogOnStopEvent = true;
|
||||||
|
|
||||||
|
int lowGlucoseMgPerDl = 80;
|
||||||
|
int moderateGlucoseMgPerDl = 140;
|
||||||
|
int highGlucoseMgPerDl = 240;
|
||||||
|
|
||||||
|
double lowGlucoseMmolPerL = 4.44;
|
||||||
|
double moderateGlucoseMmolPerL = 7.77;
|
||||||
|
double highGlucoseMmolPerDl = 13.32;
|
68
lib/main.dart
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import 'package:diameter/components/app_theme.dart';
|
||||||
|
import 'package:diameter/screens/accuracy_detail.dart';
|
||||||
|
import 'package:diameter/screens/basal/basal_profile_detail.dart';
|
||||||
|
import 'package:diameter/screens/bolus/bolus_profile_detail.dart';
|
||||||
|
import 'package:diameter/screens/log/log.dart';
|
||||||
|
import 'package:diameter/screens/log/log_entry.dart';
|
||||||
|
import 'package:diameter/screens/log/log_event_detail.dart';
|
||||||
|
import 'package:diameter/screens/log/log_event_type_detail.dart';
|
||||||
|
import 'package:diameter/screens/log/log_event_type_list.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_category_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_category_list.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_list.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_portion_type_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_portion_type_list.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_source_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_source_list.dart';
|
||||||
|
import 'package:diameter/settings.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
import 'package:diameter/screens/accuracy_list.dart';
|
||||||
|
import 'package:diameter/config.dart';
|
||||||
|
import 'package:diameter/screens/basal/basal_profiles_list.dart';
|
||||||
|
import 'package:diameter/screens/bolus/bolus_profile_list.dart';
|
||||||
|
import 'package:diameter/navigation.dart';
|
||||||
|
import 'package:flex_color_scheme/flex_color_scheme.dart';
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
await Parse().initialize(keyApplicationId, keyParseServerUrl,
|
||||||
|
clientKey: keyClientKey, debug: true);
|
||||||
|
|
||||||
|
Settings.loadSettingsIntoConfig();
|
||||||
|
|
||||||
|
runApp(
|
||||||
|
MaterialApp(
|
||||||
|
theme: AppTheme.makeTheme(AppTheme.lightTheme),
|
||||||
|
darkTheme: AppTheme.makeTheme(AppTheme.darkTheme),
|
||||||
|
themeMode: ThemeMode.system,
|
||||||
|
initialRoute: '/',
|
||||||
|
routes: {
|
||||||
|
'/': (context) => const LogScreen(),
|
||||||
|
Routes.log: (context) => const LogScreen(),
|
||||||
|
Routes.logEntry: (context) => const LogEntryScreen(),
|
||||||
|
Routes.logEvent: (context) => const LogEventDetailScreen(),
|
||||||
|
Routes.logEventTypes: (context) => const LogEventTypeListScreen(),
|
||||||
|
Routes.logEventType: (context) => const LogEventTypeDetailScreen(),
|
||||||
|
Routes.accuracies: (context) => const AccuracyListScreen(),
|
||||||
|
Routes.accuracy: (context) => const AccuracyDetailScreen(),
|
||||||
|
Routes.meals: (context) => const MealListScreen(),
|
||||||
|
Routes.meal: (context) => const MealDetailScreen(),
|
||||||
|
Routes.mealCategories: (context) => const MealCategoryListScreen(),
|
||||||
|
Routes.mealCategory: (context) => const MealCategoryDetailScreen(),
|
||||||
|
Routes.mealPortionTypes: (context) => const MealPortionTypeListScreen(),
|
||||||
|
Routes.mealPortionType: (context) =>
|
||||||
|
const MealPortionTypeDetailScreen(),
|
||||||
|
Routes.mealSources: (context) => const MealSourceListScreen(),
|
||||||
|
Routes.mealSource: (context) => const MealSourceDetailScreen(),
|
||||||
|
Routes.bolusProfiles: (context) => const BolusProfileListScreen(),
|
||||||
|
Routes.bolusProfile: (context) => const BolusProfileDetailScreen(),
|
||||||
|
Routes.basalProfiles: (context) => const BasalProfileListScreen(),
|
||||||
|
Routes.basalProfile: (context) => const BasalProfileDetailScreen(),
|
||||||
|
Routes.settings: (context) => const SettingsScreen(),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
126
lib/models/accuracy.dart
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
|
||||||
|
class Accuracy {
|
||||||
|
late String? objectId;
|
||||||
|
late String value;
|
||||||
|
late bool forCarbsRatio = false;
|
||||||
|
late bool forPortionSize = false;
|
||||||
|
late int? confidenceRating;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
Accuracy(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
value = object.get<String>('value')!;
|
||||||
|
forCarbsRatio = object.get<bool>('forCarbsRatio')!;
|
||||||
|
forPortionSize = object.get<bool>('forPortionSize')!;
|
||||||
|
confidenceRating = object.get<num>('confidenceRating') != null
|
||||||
|
? object.get<num>('confidenceRating')!.toInt()
|
||||||
|
: null;
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<Accuracy>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Accuracy'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => Accuracy(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<Accuracy>> fetchAllForCarbsRatio() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Accuracy'))
|
||||||
|
..whereEqualTo('forCarbsRatio', true);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => Accuracy(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<Accuracy>> fetchAllForPortionSize() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Accuracy'))
|
||||||
|
..whereEqualTo('forPortionSize', true);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => Accuracy(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Accuracy?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Accuracy'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return Accuracy(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required String value,
|
||||||
|
bool forCarbsRatio = false,
|
||||||
|
bool forPortionSize = false,
|
||||||
|
int? confidenceRating,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final accuracy = ParseObject('Accuracy')
|
||||||
|
..set('value', value)
|
||||||
|
..set('forCarbsRatio', forCarbsRatio)
|
||||||
|
..set('forPortionSize', forPortionSize)
|
||||||
|
..set('confidenceRating', confidenceRating)
|
||||||
|
..set('notes', notes);
|
||||||
|
await accuracy.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
String? value,
|
||||||
|
bool? forCarbsRatio,
|
||||||
|
bool? forPortionSize,
|
||||||
|
int? confidenceRating,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
var accuracy = ParseObject('Accuracy')..objectId = objectId;
|
||||||
|
if (value != null) {
|
||||||
|
accuracy.set('value', value);
|
||||||
|
}
|
||||||
|
if (forCarbsRatio != null) {
|
||||||
|
accuracy.set('forCarbsRatio', forCarbsRatio);
|
||||||
|
}
|
||||||
|
if (forPortionSize != null) {
|
||||||
|
accuracy.set('forPortionSize', forPortionSize);
|
||||||
|
}
|
||||||
|
if (confidenceRating != null) {
|
||||||
|
accuracy.set('confidenceRating', confidenceRating);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
accuracy.set('notes', notes);
|
||||||
|
}
|
||||||
|
await accuracy.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var accuracy = ParseObject('Accuracy')..objectId = objectId;
|
||||||
|
await accuracy.delete();
|
||||||
|
}
|
||||||
|
}
|
114
lib/models/basal.dart
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
import 'package:diameter/utils/date_time_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
import 'package:diameter/models/basal_profile.dart';
|
||||||
|
import 'package:diameter/components/data_table.dart';
|
||||||
|
|
||||||
|
class Basal extends DataTableContent {
|
||||||
|
late String? objectId;
|
||||||
|
late DateTime startTime;
|
||||||
|
late DateTime endTime;
|
||||||
|
late double units;
|
||||||
|
late String basalProfile;
|
||||||
|
|
||||||
|
Basal(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
startTime = object.get<DateTime>('startTime')!;
|
||||||
|
endTime = object.get<DateTime>('endTime')!;
|
||||||
|
units = object.get<num>('units')! / 100;
|
||||||
|
basalProfile =
|
||||||
|
object.get<ParseObject>('basalProfile')!.get<String>('objectId')!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Basal?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Basal'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return Basal(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<Basal>> fetchAllForBasalProfile(
|
||||||
|
BasalProfile basalProfile) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Basal'))
|
||||||
|
..whereEqualTo(
|
||||||
|
'basalProfile',
|
||||||
|
(ParseObject('BasalProfile')..objectId = basalProfile.objectId!)
|
||||||
|
.toPointer());
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!.map((e) => Basal(e as ParseObject)).toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required DateTime startTime,
|
||||||
|
required DateTime endTime,
|
||||||
|
required double units,
|
||||||
|
required String basalProfile,
|
||||||
|
}) async {
|
||||||
|
final basal = ParseObject('Basal')
|
||||||
|
..set('startTime', startTime)
|
||||||
|
..set('endTime', endTime)
|
||||||
|
..set('units', units * 100)
|
||||||
|
..set('basalProfile',
|
||||||
|
(ParseObject('BasalProfile')..objectId = basalProfile).toPointer());
|
||||||
|
await basal.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
DateTime? startTime,
|
||||||
|
DateTime? endTime,
|
||||||
|
double? units,
|
||||||
|
}) async {
|
||||||
|
var basal = ParseObject('Basal')..objectId = objectId;
|
||||||
|
if (startTime != null) {
|
||||||
|
basal.set('startTime', startTime);
|
||||||
|
}
|
||||||
|
if (endTime != null) {
|
||||||
|
basal.set('endTime', endTime);
|
||||||
|
}
|
||||||
|
if (units != null) {
|
||||||
|
basal.set('units', units * 100);
|
||||||
|
}
|
||||||
|
await basal.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var basal = ParseObject('Basal')..objectId = objectId;
|
||||||
|
await basal.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<DataCell> asDataTableCells(List<Widget>? actions) {
|
||||||
|
return [
|
||||||
|
DataCell(Text(DateTimeUtils.displayTime(startTime))),
|
||||||
|
DataCell(Text(DateTimeUtils.displayTime(endTime))),
|
||||||
|
DataCell(Text('${units.toString()} U')),
|
||||||
|
DataCell(
|
||||||
|
Row(
|
||||||
|
children: actions ?? [],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<DataColumn> asDataTableColumns() {
|
||||||
|
return [
|
||||||
|
const DataColumn(label: Expanded(child: Text('Start Time'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('End Time'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Units'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Actions'))),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
88
lib/models/basal_profile.dart
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
import 'package:diameter/models/basal.dart';
|
||||||
|
|
||||||
|
class BasalProfile {
|
||||||
|
late String? objectId;
|
||||||
|
late String name;
|
||||||
|
late bool active = false;
|
||||||
|
late Future<List<Basal>> basalRates;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
BasalProfile(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
name = object.get<String>('name')!;
|
||||||
|
active = object.get<bool>('active')!;
|
||||||
|
basalRates = Basal.fetchAllForBasalProfile(this);
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<BasalProfile>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('BasalProfile'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => BasalProfile(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<BasalProfile?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('BasalProfile'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return BasalProfile(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> setAllInactiveButOne(String? objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('BasalProfile'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
for (var basalProfile in apiResponse.results as List<ParseObject>) {
|
||||||
|
basalProfile.set(
|
||||||
|
'active', basalProfile.objectId == objectId ? true : false);
|
||||||
|
await basalProfile.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save(
|
||||||
|
{required String name, bool active = false, String? notes}) async {
|
||||||
|
final basalProfile = ParseObject('BasalProfile')
|
||||||
|
..set('name', name)
|
||||||
|
..set('active', active)
|
||||||
|
..set('notes', notes);
|
||||||
|
await basalProfile.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(String objectId,
|
||||||
|
{String? name, bool? active, String? notes}) async {
|
||||||
|
var basalProfile = ParseObject('BasalProfile')..objectId = objectId;
|
||||||
|
if (name != null) {
|
||||||
|
basalProfile.set('name', name);
|
||||||
|
}
|
||||||
|
if (active != null) {
|
||||||
|
basalProfile.set('active', active);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
basalProfile.set('notes', notes);
|
||||||
|
}
|
||||||
|
await basalProfile.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var basalProfile = ParseObject('BasalProfile')..objectId = objectId;
|
||||||
|
await basalProfile.delete();
|
||||||
|
}
|
||||||
|
}
|
199
lib/models/bolus.dart
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
import 'package:diameter/config.dart';
|
||||||
|
import 'package:diameter/settings.dart';
|
||||||
|
import 'package:diameter/utils/date_time_utils.dart';
|
||||||
|
import 'package:diameter/utils/utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
import 'package:diameter/components/data_table.dart';
|
||||||
|
import 'package:diameter/models/bolus_profile.dart';
|
||||||
|
|
||||||
|
class Bolus extends DataTableContent {
|
||||||
|
late String? objectId;
|
||||||
|
late DateTime startTime;
|
||||||
|
late DateTime endTime;
|
||||||
|
late double units;
|
||||||
|
late double carbs;
|
||||||
|
late int? mgPerDl;
|
||||||
|
late double? mmolPerL;
|
||||||
|
late String bolusProfile;
|
||||||
|
|
||||||
|
Bolus(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
startTime = object.get<DateTime>('startTime')!;
|
||||||
|
endTime = object.get<DateTime>('endTime')!;
|
||||||
|
units = object.get<num>('units')! / 100;
|
||||||
|
carbs = object.get<num>('carbs')!.toDouble();
|
||||||
|
mgPerDl = object.get<num>('mgPerDl') != null
|
||||||
|
? object.get<num>('mgPerDl')!.toInt()
|
||||||
|
: null;
|
||||||
|
mmolPerL = object.get<num>('mmolPerL') != null
|
||||||
|
? object.get<num>('mmolPerL')! / 100
|
||||||
|
: null;
|
||||||
|
bolusProfile =
|
||||||
|
object.get<ParseObject>('bolusProfile')!.get<String>('objectId')!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Bolus?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Bolus'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return Bolus(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<Bolus>> fetchAllForBolusProfile(
|
||||||
|
BolusProfile bolusProfile) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Bolus'))
|
||||||
|
..whereEqualTo(
|
||||||
|
'bolusProfile',
|
||||||
|
(ParseObject('BolusProfile')..objectId = bolusProfile.objectId!)
|
||||||
|
.toPointer());
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!.map((e) => Bolus(e as ParseObject)).toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required DateTime startTime,
|
||||||
|
required DateTime endTime,
|
||||||
|
required double units,
|
||||||
|
required double carbs,
|
||||||
|
int? mgPerDl,
|
||||||
|
double? mmolPerL,
|
||||||
|
required String bolusProfile,
|
||||||
|
}) async {
|
||||||
|
final bolus = ParseObject('Bolus')
|
||||||
|
..set('startTime', startTime)
|
||||||
|
..set('endTime', endTime)
|
||||||
|
..set('units', units * 100)
|
||||||
|
..set('carbs', carbs.round())
|
||||||
|
..set('bolusProfile',
|
||||||
|
(ParseObject('BolusProfile')..objectId = bolusProfile).toPointer());
|
||||||
|
|
||||||
|
bolus.set(
|
||||||
|
'mgPerDl',
|
||||||
|
mgPerDl != null
|
||||||
|
? mgPerDl.round()
|
||||||
|
: Utils.convertMmolPerLToMgPerDl(mmolPerL ?? 0));
|
||||||
|
bolus.set(
|
||||||
|
'mmolPerL',
|
||||||
|
mmolPerL != null
|
||||||
|
? mmolPerL * 100
|
||||||
|
: Utils.convertMgPerDlToMmolPerL(mgPerDl ?? 0) * 100);
|
||||||
|
|
||||||
|
await bolus.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
DateTime? startTime,
|
||||||
|
DateTime? endTime,
|
||||||
|
double? units,
|
||||||
|
double? carbs,
|
||||||
|
int? mgPerDl,
|
||||||
|
double? mmolPerL,
|
||||||
|
}) async {
|
||||||
|
var bolus = ParseObject('Bolus')..objectId = objectId;
|
||||||
|
if (startTime != null) {
|
||||||
|
bolus.set('startTime', startTime);
|
||||||
|
}
|
||||||
|
if (endTime != null) {
|
||||||
|
bolus.set('endTime', endTime);
|
||||||
|
}
|
||||||
|
if (units != null) {
|
||||||
|
bolus.set('units', units * 100);
|
||||||
|
}
|
||||||
|
if (carbs != null) {
|
||||||
|
bolus.set('carbs', carbs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mgPerDl != null || mmolPerL != null) {
|
||||||
|
bolus.set(
|
||||||
|
'mgPerDl',
|
||||||
|
mgPerDl != null
|
||||||
|
? mgPerDl.round()
|
||||||
|
: Utils.convertMmolPerLToMgPerDl(mmolPerL ?? 0));
|
||||||
|
bolus.set(
|
||||||
|
'mmolPerL',
|
||||||
|
mmolPerL != null
|
||||||
|
? mmolPerL * 100
|
||||||
|
: Utils.convertMgPerDlToMmolPerL(mgPerDl ?? 0) * 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
await bolus.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var bolus = ParseObject('Bolus')..objectId = objectId;
|
||||||
|
await bolus.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<DataCell> asDataTableCells(List<Widget>? actions) {
|
||||||
|
var cols = [
|
||||||
|
DataCell(Text(DateTimeUtils.displayTime(startTime))),
|
||||||
|
DataCell(Text(DateTimeUtils.displayTime(endTime))),
|
||||||
|
DataCell(Text('${units.toString()} U')),
|
||||||
|
DataCell(Text('${carbs.toString()} g')),
|
||||||
|
];
|
||||||
|
|
||||||
|
if (glucoseMeasurement == GlucoseMeasurement.mgPerDl ||
|
||||||
|
glucoseDisplayMode == GlucoseDisplayMode.both ||
|
||||||
|
glucoseDisplayMode == GlucoseDisplayMode.bothForList) {
|
||||||
|
cols.add(DataCell(Text('${mgPerDl.toString()} mg/dl')));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (glucoseMeasurement == GlucoseMeasurement.mmolPerL ||
|
||||||
|
glucoseDisplayMode == GlucoseDisplayMode.both ||
|
||||||
|
glucoseDisplayMode == GlucoseDisplayMode.bothForList) {
|
||||||
|
cols.add(DataCell(Text('${mmolPerL.toString()} mmol/l')));
|
||||||
|
}
|
||||||
|
|
||||||
|
cols.add(
|
||||||
|
DataCell(
|
||||||
|
Row(
|
||||||
|
children: actions ?? [],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return cols;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<DataColumn> asDataTableColumns() {
|
||||||
|
var cols = [
|
||||||
|
const DataColumn(label: Expanded(child: Text('Start Time'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('End Time'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Units'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('per Carbs'))),
|
||||||
|
];
|
||||||
|
|
||||||
|
if (glucoseMeasurement == GlucoseMeasurement.mgPerDl ||
|
||||||
|
glucoseDisplayMode == GlucoseDisplayMode.both ||
|
||||||
|
glucoseDisplayMode == GlucoseDisplayMode.bothForList) {
|
||||||
|
cols.add(const DataColumn(label: Expanded(child: Text('per mg/dl'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (glucoseMeasurement == GlucoseMeasurement.mmolPerL ||
|
||||||
|
glucoseDisplayMode == GlucoseDisplayMode.both ||
|
||||||
|
glucoseDisplayMode == GlucoseDisplayMode.bothForList) {
|
||||||
|
cols.add(const DataColumn(label: Expanded(child: Text('per mmol/l'))));
|
||||||
|
}
|
||||||
|
|
||||||
|
cols.add(
|
||||||
|
const DataColumn(label: Expanded(child: Text('Actions'))),
|
||||||
|
);
|
||||||
|
|
||||||
|
return cols;
|
||||||
|
}
|
||||||
|
}
|
88
lib/models/bolus_profile.dart
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
import 'package:diameter/models/bolus.dart';
|
||||||
|
|
||||||
|
class BolusProfile {
|
||||||
|
late String? objectId;
|
||||||
|
late String name;
|
||||||
|
late bool active = false;
|
||||||
|
late Future<List<Bolus>> bolusRates;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
BolusProfile(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
name = object.get<String>('name')!;
|
||||||
|
active = object.get<bool>('active')!;
|
||||||
|
bolusRates = Bolus.fetchAllForBolusProfile(this);
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<BolusProfile>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('BolusProfile'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => BolusProfile(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<BolusProfile?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('BolusProfile'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return BolusProfile(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> setAllInactiveButOne(String? objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('BolusProfile'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
for (var bolusProfile in apiResponse.results as List<ParseObject>) {
|
||||||
|
bolusProfile.set(
|
||||||
|
'active', bolusProfile.objectId == objectId ? true : false);
|
||||||
|
await bolusProfile.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save(
|
||||||
|
{required String name, bool active = false, String? notes}) async {
|
||||||
|
final bolusProfile = ParseObject('BolusProfile')
|
||||||
|
..set('name', name)
|
||||||
|
..set('active', active)
|
||||||
|
..set('notes', notes);
|
||||||
|
await bolusProfile.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(String objectId,
|
||||||
|
{String? name, bool? active, String? notes}) async {
|
||||||
|
var bolusProfile = ParseObject('BolusProfile')..objectId = objectId;
|
||||||
|
if (name != null) {
|
||||||
|
bolusProfile.set('name', name);
|
||||||
|
}
|
||||||
|
if (active != null) {
|
||||||
|
bolusProfile.set('active', active);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
bolusProfile.set('notes', notes);
|
||||||
|
}
|
||||||
|
await bolusProfile.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var bolusProfile = ParseObject('BolusProfile')..objectId = objectId;
|
||||||
|
await bolusProfile.delete();
|
||||||
|
}
|
||||||
|
}
|
169
lib/models/log_entry.dart
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
import 'package:diameter/models/log_meal.dart';
|
||||||
|
import 'package:diameter/utils/utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
import 'package:diameter/models/log_event.dart';
|
||||||
|
|
||||||
|
class LogEntry {
|
||||||
|
late String? objectId;
|
||||||
|
late DateTime time;
|
||||||
|
late int? mgPerDl;
|
||||||
|
late double? mmolPerL;
|
||||||
|
late double? bolusGlucose;
|
||||||
|
late int? delayedBolusDuration;
|
||||||
|
// TODO: either rename this or all other fields using delayedBolusRate
|
||||||
|
late double? delayedBolusRatio;
|
||||||
|
late String? notes;
|
||||||
|
late Future<List<LogEvent>> events;
|
||||||
|
late Future<List<LogEvent>> endedEvents;
|
||||||
|
late Future<List<LogMeal>> meals;
|
||||||
|
|
||||||
|
LogEntry(ParseObject object) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
time = object.get<DateTime>('time')!;
|
||||||
|
mgPerDl = object.get<num>('mgPerDl') != null
|
||||||
|
? object.get<num>('mgPerDl')!.toInt()
|
||||||
|
: null;
|
||||||
|
mmolPerL = object.get<num>('mmolPerL') != null
|
||||||
|
? object.get<num>('mmolPerL')!.toDouble()
|
||||||
|
: null;
|
||||||
|
bolusGlucose = object.get<num>('bolusGlucose') != null
|
||||||
|
? object.get<num>('bolusGlucose')!.toDouble()
|
||||||
|
: null;
|
||||||
|
delayedBolusDuration = object.get<num>('delayedBolusDuration') != null
|
||||||
|
? object.get<num>('delayedBolusDuration')!.toInt()
|
||||||
|
: null;
|
||||||
|
delayedBolusRatio = object.get<num>('delayedBolusRatio') != null
|
||||||
|
? object.get<num>('delayedBolusRatio')!.toDouble()
|
||||||
|
: null;
|
||||||
|
events = LogEvent.fetchAllForLogEntry(this);
|
||||||
|
endedEvents = LogEvent.fetchAllEndedByEntry(this);
|
||||||
|
meals = LogMeal.fetchAllForLogEntry(this);
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<LogEntry>> fetchAllForRange(DateTimeRange range) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('LogEntry'))
|
||||||
|
..whereGreaterThanOrEqualsTo('time', range.start)
|
||||||
|
..whereLessThanOrEqualTo('time', range.end);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => LogEntry(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<LogEntry>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('LogEntry'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => LogEntry(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<LogEntry?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('LogEntry'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return LogEntry(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required DateTime time,
|
||||||
|
int? mgPerDl,
|
||||||
|
double? mmolPerL,
|
||||||
|
double? bolusGlucose,
|
||||||
|
int? delayedBolusDuration,
|
||||||
|
double? delayedBolusRatio,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final logEntry = ParseObject('LogEntry')
|
||||||
|
..set('time', time)
|
||||||
|
..set('bolusGlucose', bolusGlucose)
|
||||||
|
..set('delayedBolusDuration', delayedBolusDuration)
|
||||||
|
..set('delayedBolusRatio', delayedBolusRatio)
|
||||||
|
..set('notes', notes);
|
||||||
|
|
||||||
|
if (!(mgPerDl == null && mmolPerL == null)) {
|
||||||
|
logEntry.set(
|
||||||
|
'mgPerDl',
|
||||||
|
mgPerDl != null
|
||||||
|
? mgPerDl.round()
|
||||||
|
: Utils.convertMmolPerLToMgPerDl(mmolPerL ?? 0));
|
||||||
|
logEntry.set(
|
||||||
|
'mmolPerL',
|
||||||
|
mmolPerL != null
|
||||||
|
? mmolPerL * 100
|
||||||
|
: Utils.convertMgPerDlToMmolPerL(mgPerDl ?? 0) * 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
await logEntry.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
DateTime? time,
|
||||||
|
int? mgPerDl,
|
||||||
|
double? mmolPerL,
|
||||||
|
double? bolusGlucose,
|
||||||
|
int? delayedBolusDuration,
|
||||||
|
double? delayedBolusRatio,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final logEntry = ParseObject('LogEntry');
|
||||||
|
|
||||||
|
if (time != null) {
|
||||||
|
logEntry.set('time', time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bolusGlucose != null) {
|
||||||
|
logEntry.set('bolusGlucose', bolusGlucose);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delayedBolusDuration != null) {
|
||||||
|
logEntry.set('delayedBolusDuration', delayedBolusDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delayedBolusRatio != null) {
|
||||||
|
logEntry.set('delayedBolusRatio', delayedBolusRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notes != null) {
|
||||||
|
logEntry.set('notes', notes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(mgPerDl == null && mmolPerL == null)) {
|
||||||
|
logEntry.set(
|
||||||
|
'mgPerDl',
|
||||||
|
mgPerDl != null
|
||||||
|
? mgPerDl.round()
|
||||||
|
: Utils.convertMmolPerLToMgPerDl(mmolPerL ?? 0));
|
||||||
|
logEntry.set(
|
||||||
|
'mmolPerL',
|
||||||
|
mmolPerL != null
|
||||||
|
? mmolPerL * 100
|
||||||
|
: Utils.convertMgPerDlToMmolPerL(mgPerDl ?? 0) * 100);
|
||||||
|
}
|
||||||
|
await logEntry.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var logEntry = ParseObject('LogEntry')..objectId = objectId;
|
||||||
|
await logEntry.delete();
|
||||||
|
}
|
||||||
|
}
|
176
lib/models/log_event.dart
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
import 'package:diameter/components/data_table.dart';
|
||||||
|
import 'package:diameter/models/log_entry.dart';
|
||||||
|
import 'package:diameter/models/log_event_type.dart';
|
||||||
|
import 'package:diameter/utils/date_time_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
|
||||||
|
class LogEvent extends DataTableContent {
|
||||||
|
late String? objectId;
|
||||||
|
late String logEntry;
|
||||||
|
late String? endLogEntry;
|
||||||
|
late String eventType;
|
||||||
|
late DateTime time;
|
||||||
|
late DateTime? endTime;
|
||||||
|
late bool hasEndTime;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
LogEvent(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
logEntry = object.get<ParseObject>('logEntry')!.get<String>('objectId')!;
|
||||||
|
endLogEntry =
|
||||||
|
object.get<ParseObject>('endLogEntry')?.get<String>('objectId');
|
||||||
|
eventType =
|
||||||
|
object.get<ParseObject>('eventType')!.get<String>('objectId')!;
|
||||||
|
time = object.get<DateTime>('time')!;
|
||||||
|
endTime = object.get<DateTime>('endTime');
|
||||||
|
hasEndTime = object.get<bool>('hasEndTime')!;
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<LogEvent?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('LogEvent'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return LogEvent(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<LogEvent>> fetchAllActive() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('LogEvent'))
|
||||||
|
..whereEqualTo('hasEndTime', true)
|
||||||
|
..whereEqualTo('endTime', null);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => LogEvent(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<LogEvent>> fetchAllForLogEntry(LogEntry logEntry) async {
|
||||||
|
QueryBuilder<ParseObject> query = QueryBuilder<ParseObject>(
|
||||||
|
ParseObject('LogEvent'))
|
||||||
|
..whereEqualTo('logEntry',
|
||||||
|
(ParseObject('LogEntry')..objectId = logEntry.objectId!).toPointer());
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => LogEvent(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<LogEvent>> fetchAllEndedByEntry(LogEntry logEntry) async {
|
||||||
|
QueryBuilder<ParseObject> query = QueryBuilder<ParseObject>(
|
||||||
|
ParseObject('LogEvent'))
|
||||||
|
..whereEqualTo('endLogEntry',
|
||||||
|
(ParseObject('LogEntry')..objectId = logEntry.objectId!).toPointer());
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => LogEvent(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required String logEntry,
|
||||||
|
required String eventType,
|
||||||
|
required DateTime time,
|
||||||
|
required bool hasEndTime,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final logEvent = ParseObject('LogEvent')
|
||||||
|
..set('logEntry',
|
||||||
|
(ParseObject('LogEntry')..objectId = logEntry).toPointer())
|
||||||
|
..set('eventType',
|
||||||
|
(ParseObject('LogEventType')..objectId = eventType).toPointer())
|
||||||
|
..set('time', time)
|
||||||
|
..set('hasEndTime', hasEndTime)
|
||||||
|
..set('notes', notes);
|
||||||
|
await logEvent.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
String? eventType,
|
||||||
|
String? endLogEntry,
|
||||||
|
DateTime? time,
|
||||||
|
DateTime? endTime,
|
||||||
|
bool? hasEndTime,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
var logEvent = ParseObject('LogEvent')..objectId = objectId;
|
||||||
|
if (eventType != null) {
|
||||||
|
logEvent.set('eventType',
|
||||||
|
(ParseObject('LogEventType')..objectId = eventType).toPointer());
|
||||||
|
}
|
||||||
|
if (endLogEntry != null) {
|
||||||
|
logEvent.set('endLogEntry',
|
||||||
|
(ParseObject('LogEntry')..objectId = endLogEntry).toPointer());
|
||||||
|
}
|
||||||
|
if (time != null) {
|
||||||
|
logEvent.set('time', time);
|
||||||
|
}
|
||||||
|
if (endTime != null) {
|
||||||
|
logEvent.set('endTime', endTime);
|
||||||
|
}
|
||||||
|
if (hasEndTime != null) {
|
||||||
|
logEvent.set('hasEndTime', hasEndTime);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
logEvent.set('notes', notes);
|
||||||
|
}
|
||||||
|
await logEvent.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var logEvent = ParseObject('LogEvent')..objectId = objectId;
|
||||||
|
await logEvent.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<DataCell> asDataTableCells(List<Widget> actions,
|
||||||
|
{List<LogEventType>? types}) {
|
||||||
|
return [
|
||||||
|
DataCell(Text(
|
||||||
|
types?.firstWhere((element) => element.objectId == eventType).value ??
|
||||||
|
types?.length.toString() ??
|
||||||
|
'')),
|
||||||
|
DataCell(Text(DateTimeUtils.displayDateTime(time))),
|
||||||
|
DataCell(Text(hasEndTime
|
||||||
|
? DateTimeUtils.displayDateTime(endTime, fallback: 'ongoing')
|
||||||
|
: '-')),
|
||||||
|
DataCell(
|
||||||
|
Row(
|
||||||
|
children: actions,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<DataColumn> asDataTableColumns() {
|
||||||
|
return [
|
||||||
|
const DataColumn(label: Expanded(child: Text('Event Type'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Start Time'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('End Time'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Actions'))),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
86
lib/models/log_event_type.dart
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
|
||||||
|
class LogEventType {
|
||||||
|
late String? objectId;
|
||||||
|
late String value;
|
||||||
|
late bool hasEndTime;
|
||||||
|
late int? defaultReminderDuration;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
LogEventType(ParseObject object) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
value = object.get<String>('value')!;
|
||||||
|
hasEndTime = object.get<bool>('hasEndTime')!;
|
||||||
|
defaultReminderDuration = object.get<num>('defaultReminderDuration') != null
|
||||||
|
? object.get<num>('defaultReminderDuration')!.toInt()
|
||||||
|
: null;
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<LogEventType>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('LogEventType'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => LogEventType(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<LogEventType?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('LogEventType'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return LogEventType(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required String value,
|
||||||
|
required bool hasEndTime,
|
||||||
|
int? defaultReminderDuration,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final logEventType = ParseObject('LogEventType')
|
||||||
|
..set('value', value)
|
||||||
|
..set('hasEndTime', hasEndTime)
|
||||||
|
..set('defaultReminderDuration', defaultReminderDuration)
|
||||||
|
..set('notes', notes);
|
||||||
|
await logEventType.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
String? value,
|
||||||
|
bool? hasEndTime,
|
||||||
|
int? defaultReminderDuration,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
var logEventType = ParseObject('LogEventType')..objectId = objectId;
|
||||||
|
if (value != null) {
|
||||||
|
logEventType.set('value', value);
|
||||||
|
}
|
||||||
|
if (hasEndTime != null) {
|
||||||
|
logEventType.set('hasEndTime', hasEndTime);
|
||||||
|
}
|
||||||
|
if (defaultReminderDuration != null) {
|
||||||
|
logEventType.set('defaultReminderDuration', defaultReminderDuration);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
logEventType.set('notes', notes);
|
||||||
|
}
|
||||||
|
await logEventType.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var logEventType = ParseObject('LogEventType')..objectId = objectId;
|
||||||
|
await logEventType.delete();
|
||||||
|
}
|
||||||
|
}
|
248
lib/models/log_meal.dart
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
import 'package:diameter/components/data_table.dart';
|
||||||
|
import 'package:diameter/models/log_entry.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
|
||||||
|
class LogMeal extends DataTableContent {
|
||||||
|
late String? objectId;
|
||||||
|
late String logEntry;
|
||||||
|
late String? meal;
|
||||||
|
late String value;
|
||||||
|
late String? source;
|
||||||
|
late String? category;
|
||||||
|
late String? portionType;
|
||||||
|
late double? carbsRatio;
|
||||||
|
late double? portionSize;
|
||||||
|
late double? carbsPerPortion;
|
||||||
|
late String? portionSizeAccuracy;
|
||||||
|
late String? carbsRatioAccuracy;
|
||||||
|
late double? bolus;
|
||||||
|
late int? delayedBolusDuration;
|
||||||
|
late double? delayedBolusRate;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
LogMeal(ParseObject object) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
logEntry = object.get<ParseObject>('logEntry')!.get<String>('objectId')!;
|
||||||
|
meal = object.get<ParseObject>('meal') != null
|
||||||
|
? object.get<ParseObject>('meal')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
value = object.get<String>('value')!;
|
||||||
|
source = object.get<ParseObject>('source') != null
|
||||||
|
? object.get<ParseObject>('source')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
category = object.get<ParseObject>('category') != null
|
||||||
|
? object.get<ParseObject>('category')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
portionType = object.get<ParseObject>('portionType') != null
|
||||||
|
? object.get<ParseObject>('portionType')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
carbsRatio = object.get<num>('carbsRatio')!.toDouble();
|
||||||
|
portionSize = object.get<num>('portionSize')!.toDouble();
|
||||||
|
carbsPerPortion = object.get<num>('carbsPerPortion')!.toDouble();
|
||||||
|
portionSizeAccuracy = object.get<ParseObject>('portionSizeAccuracy') != null
|
||||||
|
? object
|
||||||
|
.get<ParseObject>('portionSizeAccuracy')!
|
||||||
|
.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
carbsRatioAccuracy = object.get<ParseObject>('carbsRatioAccuracy') != null
|
||||||
|
? object.get<ParseObject>('carbsRatioAccuracy')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
bolus = object.get<num>('bolus') != null
|
||||||
|
? object.get<num>('bolus')!.toDouble()
|
||||||
|
: null;
|
||||||
|
delayedBolusDuration = object.get<num>('delayedBolusDuration') != null
|
||||||
|
? object.get<num>('delayedBolusDuration')!.toInt()
|
||||||
|
: null;
|
||||||
|
delayedBolusRate = object.get<num>('delayedBolusRate') != null
|
||||||
|
? object.get<num>('delayedBolusRate')!.toDouble()
|
||||||
|
: null;
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<LogMeal?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('LogMeal'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return LogMeal(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<LogMeal>> fetchAllForLogEntry(LogEntry logEntry) async {
|
||||||
|
QueryBuilder<ParseObject> query = QueryBuilder<ParseObject>(
|
||||||
|
ParseObject('LogMeal'))
|
||||||
|
..whereEqualTo('logEntry',
|
||||||
|
(ParseObject('LogEntry')..objectId = logEntry.objectId!).toPointer());
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => LogMeal(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required String value,
|
||||||
|
required String logEntry,
|
||||||
|
String? meal,
|
||||||
|
String? source,
|
||||||
|
String? category,
|
||||||
|
String? portionType,
|
||||||
|
double? carbsRatio,
|
||||||
|
double? portionSize,
|
||||||
|
double? carbsPerPortion,
|
||||||
|
String? portionSizeAccuracy,
|
||||||
|
String? carbsRatioAccuracy,
|
||||||
|
double? bolus,
|
||||||
|
int? delayedBolusDuration,
|
||||||
|
double? delayedBolusRate,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final logMeal = ParseObject('Meal')
|
||||||
|
..set('value', value)
|
||||||
|
..set('logEntry',
|
||||||
|
(ParseObject('LogEntry')..objectId = logEntry).toPointer())
|
||||||
|
..set('carbsRatio', carbsRatio)
|
||||||
|
..set('portionSize', portionSize)
|
||||||
|
..set('carbsPerPortion', carbsPerPortion)
|
||||||
|
..set('bolus', bolus)
|
||||||
|
..set('delayedBolusDuration', delayedBolusDuration)
|
||||||
|
..set('delayedBolusRate', delayedBolusRate)
|
||||||
|
..set('notes', notes);
|
||||||
|
|
||||||
|
if (meal != null) {
|
||||||
|
logMeal.set('meal', (ParseObject('Meal')..objectId = meal).toPointer());
|
||||||
|
}
|
||||||
|
if (source != null) {
|
||||||
|
logMeal.set(
|
||||||
|
'source', (ParseObject('MealSource')..objectId = source).toPointer());
|
||||||
|
}
|
||||||
|
if (category != null) {
|
||||||
|
logMeal.set('category',
|
||||||
|
(ParseObject('MealCategory')..objectId = category).toPointer());
|
||||||
|
}
|
||||||
|
if (portionType != null) {
|
||||||
|
logMeal.set('portionType',
|
||||||
|
(ParseObject('MealPortionType')..objectId = portionType).toPointer());
|
||||||
|
}
|
||||||
|
if (portionSizeAccuracy != null) {
|
||||||
|
logMeal.set(
|
||||||
|
'portionSizeAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = portionSizeAccuracy)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (carbsRatioAccuracy != null) {
|
||||||
|
logMeal.set('carbsRatioAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = carbsRatioAccuracy).toPointer());
|
||||||
|
}
|
||||||
|
await logMeal.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
String? value,
|
||||||
|
String? meal,
|
||||||
|
String? source,
|
||||||
|
String? category,
|
||||||
|
String? portionType,
|
||||||
|
double? carbsRatio,
|
||||||
|
double? portionSize,
|
||||||
|
double? carbsPerPortion,
|
||||||
|
String? portionSizeAccuracy,
|
||||||
|
String? carbsRatioAccuracy,
|
||||||
|
double? bolus,
|
||||||
|
int? delayedBolusDuration,
|
||||||
|
double? delayedBolusRate,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
var logMeal = ParseObject('Meal')..objectId = objectId;
|
||||||
|
if (value != null) {
|
||||||
|
logMeal.set('value', value);
|
||||||
|
}
|
||||||
|
if (meal != null) {
|
||||||
|
logMeal.set('meal', (ParseObject('Meal')..objectId = meal).toPointer());
|
||||||
|
}
|
||||||
|
if (source != null) {
|
||||||
|
logMeal.set(
|
||||||
|
'source', (ParseObject('MealSource')..objectId = source).toPointer());
|
||||||
|
}
|
||||||
|
if (category != null) {
|
||||||
|
logMeal.set('category',
|
||||||
|
(ParseObject('MealCategory')..objectId = category).toPointer());
|
||||||
|
}
|
||||||
|
if (portionType != null) {
|
||||||
|
logMeal.set('portionType',
|
||||||
|
(ParseObject('MealPortionType')..objectId = portionType).toPointer());
|
||||||
|
}
|
||||||
|
if (carbsRatio != null) {
|
||||||
|
logMeal.set('carbsRatio', carbsRatio);
|
||||||
|
}
|
||||||
|
if (portionSize != null) {
|
||||||
|
logMeal.set('portionSize', portionSize);
|
||||||
|
}
|
||||||
|
if (carbsPerPortion != null) {
|
||||||
|
logMeal.set('carbsPerPortion', carbsPerPortion);
|
||||||
|
}
|
||||||
|
if (portionSizeAccuracy != null) {
|
||||||
|
logMeal.set(
|
||||||
|
'portionSizeAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = portionSizeAccuracy)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (carbsRatioAccuracy != null) {
|
||||||
|
logMeal.set('carbsRatioAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = carbsRatioAccuracy).toPointer());
|
||||||
|
}
|
||||||
|
if (bolus != null) {
|
||||||
|
logMeal.set('bolus', bolus);
|
||||||
|
}
|
||||||
|
if (delayedBolusDuration != null) {
|
||||||
|
logMeal.set('delayedBolusDuration', delayedBolusDuration);
|
||||||
|
}
|
||||||
|
if (delayedBolusRate != null) {
|
||||||
|
logMeal.set('delayedBolusRate', delayedBolusRate);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
logMeal.set('notes', notes);
|
||||||
|
}
|
||||||
|
await logMeal.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var logMeal = ParseObject('LogMeal')..objectId = objectId;
|
||||||
|
await logMeal.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<DataCell> asDataTableCells(List<Widget>? actions) {
|
||||||
|
return [
|
||||||
|
DataCell(Text(value)),
|
||||||
|
DataCell(Text('${(carbsPerPortion ?? '').toString()} g')),
|
||||||
|
DataCell(Text('${(bolus ?? '').toString()} U')),
|
||||||
|
DataCell(Text(delayedBolusRate != null
|
||||||
|
? '${delayedBolusRate.toString()} U/${(delayedBolusDuration ?? '').toString()} min'
|
||||||
|
: '')),
|
||||||
|
DataCell(
|
||||||
|
Row(
|
||||||
|
children: actions ?? [],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<DataColumn> asDataTableColumns() {
|
||||||
|
return [
|
||||||
|
const DataColumn(label: Expanded(child: Text('Meal'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Carbs'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Bolus'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Delayed Bolus'))),
|
||||||
|
const DataColumn(label: Expanded(child: Text('Actions'))),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
193
lib/models/meal.dart
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
|
||||||
|
class Meal {
|
||||||
|
late String? objectId;
|
||||||
|
late String value;
|
||||||
|
late String? source;
|
||||||
|
late String? category;
|
||||||
|
late String? portionType;
|
||||||
|
late double? carbsRatio;
|
||||||
|
late double? portionSize;
|
||||||
|
late double? carbsPerPortion;
|
||||||
|
late String? portionSizeAccuracy;
|
||||||
|
late String? carbsRatioAccuracy;
|
||||||
|
late int? delayedBolusDuration;
|
||||||
|
late double? delayedBolusRate;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
Meal(ParseObject object) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
value = object.get<String>('value')!;
|
||||||
|
source = object.get<ParseObject>('source') != null
|
||||||
|
? object.get<ParseObject>('source')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
category = object.get<ParseObject>('category') != null
|
||||||
|
? object.get<ParseObject>('category')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
portionType = object.get<ParseObject>('portionType') != null
|
||||||
|
? object.get<ParseObject>('portionType')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
carbsRatio = object.get<num>('carbsRatio') != null
|
||||||
|
? object.get<num>('carbsRatio')!.toDouble()
|
||||||
|
: null;
|
||||||
|
portionSize = object.get<num>('portionSize') != null
|
||||||
|
? object.get<num>('portionSize')!.toDouble()
|
||||||
|
: null;
|
||||||
|
carbsPerPortion = object.get<num>('carbsPerPortion') != null
|
||||||
|
? object.get<num>('carbsPerPortion')!.toDouble()
|
||||||
|
: null;
|
||||||
|
portionSizeAccuracy = object.get<ParseObject>('portionSizeAccuracy') != null
|
||||||
|
? object
|
||||||
|
.get<ParseObject>('portionSizeAccuracy')!
|
||||||
|
.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
carbsRatioAccuracy = object.get<ParseObject>('carbsRatioAccuracy') != null
|
||||||
|
? object.get<ParseObject>('carbsRatioAccuracy')!.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
delayedBolusDuration = object.get<num>('delayedBolusDuration') != null
|
||||||
|
? object.get<num>('delayedBolusDuration')!.toInt()
|
||||||
|
: null;
|
||||||
|
delayedBolusRate = object.get<num>('delayedBolusRate') != null
|
||||||
|
? object.get<num>('delayedBolusRate')!.toDouble()
|
||||||
|
: null;
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<Meal>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Meal'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!.map((e) => Meal(e as ParseObject)).toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Meal?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('Meal'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return Meal(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required String value,
|
||||||
|
String? source,
|
||||||
|
String? category,
|
||||||
|
String? portionType,
|
||||||
|
double? carbsRatio,
|
||||||
|
double? portionSize,
|
||||||
|
double? carbsPerPortion,
|
||||||
|
String? portionSizeAccuracy,
|
||||||
|
String? carbsRatioAccuracy,
|
||||||
|
int? delayedBolusDuration,
|
||||||
|
double? delayedBolusRate,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final meal = ParseObject('Meal')
|
||||||
|
..set('value', value)
|
||||||
|
..set('carbsRatio', carbsRatio)
|
||||||
|
..set('portionSize', portionSize)
|
||||||
|
..set('carbsPerPortion', carbsPerPortion)
|
||||||
|
..set('delayedBolusDuration', delayedBolusDuration)
|
||||||
|
..set('delayedBolusRate', delayedBolusRate)
|
||||||
|
..set('notes', notes);
|
||||||
|
|
||||||
|
if (source != null) {
|
||||||
|
meal.set(
|
||||||
|
'source', (ParseObject('MealSource')..objectId = source).toPointer());
|
||||||
|
}
|
||||||
|
if (category != null) {
|
||||||
|
meal.set('category',
|
||||||
|
(ParseObject('MealCategory')..objectId = category).toPointer());
|
||||||
|
}
|
||||||
|
if (portionType != null) {
|
||||||
|
meal.set('portionType',
|
||||||
|
(ParseObject('MealPortionType')..objectId = portionType).toPointer());
|
||||||
|
}
|
||||||
|
if (portionSizeAccuracy != null) {
|
||||||
|
meal.set(
|
||||||
|
'portionSizeAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = portionSizeAccuracy)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (carbsRatioAccuracy != null) {
|
||||||
|
meal.set('carbsRatioAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = carbsRatioAccuracy).toPointer());
|
||||||
|
}
|
||||||
|
await meal.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
String? value,
|
||||||
|
String? source,
|
||||||
|
String? category,
|
||||||
|
String? portionType,
|
||||||
|
double? carbsRatio,
|
||||||
|
double? portionSize,
|
||||||
|
double? carbsPerPortion,
|
||||||
|
String? portionSizeAccuracy,
|
||||||
|
String? carbsRatioAccuracy,
|
||||||
|
int? delayedBolusDuration,
|
||||||
|
double? delayedBolusRate,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
var meal = ParseObject('Meal')..objectId = objectId;
|
||||||
|
if (value != null) {
|
||||||
|
meal.set('value', value);
|
||||||
|
}
|
||||||
|
if (source != null) {
|
||||||
|
meal.set(
|
||||||
|
'source', (ParseObject('MealSource')..objectId = source).toPointer());
|
||||||
|
}
|
||||||
|
if (category != null) {
|
||||||
|
meal.set('category',
|
||||||
|
(ParseObject('MealCategory')..objectId = category).toPointer());
|
||||||
|
}
|
||||||
|
if (portionType != null) {
|
||||||
|
meal.set('portionType',
|
||||||
|
(ParseObject('MealPortionType')..objectId = portionType).toPointer());
|
||||||
|
}
|
||||||
|
if (carbsRatio != null) {
|
||||||
|
meal.set('carbsRatio', carbsRatio);
|
||||||
|
}
|
||||||
|
if (portionSize != null) {
|
||||||
|
meal.set('portionSize', portionSize);
|
||||||
|
}
|
||||||
|
if (carbsPerPortion != null) {
|
||||||
|
meal.set('carbsPerPortion', carbsPerPortion);
|
||||||
|
}
|
||||||
|
if (portionSizeAccuracy != null) {
|
||||||
|
meal.set(
|
||||||
|
'portionSizeAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = portionSizeAccuracy)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (carbsRatioAccuracy != null) {
|
||||||
|
meal.set('carbsRatioAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = carbsRatioAccuracy).toPointer());
|
||||||
|
}
|
||||||
|
if (delayedBolusDuration != null) {
|
||||||
|
meal.set('delayedBolusDuration', delayedBolusDuration);
|
||||||
|
}
|
||||||
|
if (delayedBolusRate != null) {
|
||||||
|
meal.set('delayedBolusRate', delayedBolusRate);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
meal.set('notes', notes);
|
||||||
|
}
|
||||||
|
await meal.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var meal = ParseObject('Meal')..objectId = objectId;
|
||||||
|
await meal.delete();
|
||||||
|
}
|
||||||
|
}
|
68
lib/models/meal_category.dart
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
|
||||||
|
class MealCategory {
|
||||||
|
late String? objectId;
|
||||||
|
late String value;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
MealCategory(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
value = object.get<String>('value')!;
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<MealCategory>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('MealCategory'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!.map((e) => MealCategory(e as ParseObject)).toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<MealCategory?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('MealCategory'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return MealCategory(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required String value,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final mealCategory = ParseObject('MealCategory')
|
||||||
|
..set('value', value)
|
||||||
|
..set('notes', notes);
|
||||||
|
await mealCategory.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
String? value,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
var mealCategory = ParseObject('MealCategory')..objectId = objectId;
|
||||||
|
if (value != null) {
|
||||||
|
mealCategory.set('value', value);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
mealCategory.set('notes', notes);
|
||||||
|
}
|
||||||
|
await mealCategory.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var mealCategory = ParseObject('MealCategory')..objectId = objectId;
|
||||||
|
await mealCategory.delete();
|
||||||
|
}
|
||||||
|
}
|
69
lib/models/meal_portion_type.dart
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
|
||||||
|
class MealPortionType {
|
||||||
|
late String? objectId;
|
||||||
|
late String value;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
MealPortionType(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
value = object.get<String>('value')!;
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<MealPortionType>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('MealPortionType'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
// return apiResponse.results as List<ParseObject>;
|
||||||
|
return apiResponse.results!.map((e) => MealPortionType(e as ParseObject)).toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<MealPortionType?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('MealPortionType'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return MealPortionType(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required String value,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final mealPortionType = ParseObject('MealPortionType')
|
||||||
|
..set('value', value)
|
||||||
|
..set('notes', notes);
|
||||||
|
await mealPortionType.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
String? value,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
var mealPortionType = ParseObject('MealPortionType')..objectId = objectId;
|
||||||
|
if (value != null) {
|
||||||
|
mealPortionType.set('value', value);
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
mealPortionType.set('notes', notes);
|
||||||
|
}
|
||||||
|
await mealPortionType.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var mealPortionType = ParseObject('MealPortionType')..objectId = objectId;
|
||||||
|
await mealPortionType.delete();
|
||||||
|
}
|
||||||
|
}
|
157
lib/models/meal_source.dart
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
// import 'package:diameter/models/accuracy.dart';
|
||||||
|
// import 'package:diameter/models/meal_category.dart';
|
||||||
|
// import 'package:diameter/models/meal_portion_type.dart';
|
||||||
|
import 'package:parse_server_sdk_flutter/parse_server_sdk.dart';
|
||||||
|
|
||||||
|
class MealSource {
|
||||||
|
late String? objectId;
|
||||||
|
late String value;
|
||||||
|
late String? defaultCarbsRatioAccuracy;
|
||||||
|
late String? defaultPortionSizeAccuracy;
|
||||||
|
late String? defaultMealCategory;
|
||||||
|
late String? defaultMealPortionType;
|
||||||
|
late String? notes;
|
||||||
|
|
||||||
|
MealSource(ParseObject? object) {
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.get<String>('objectId');
|
||||||
|
value = object.get<String>('value')!;
|
||||||
|
defaultCarbsRatioAccuracy =
|
||||||
|
object.get<ParseObject>('defaultCarbsRatioAccuracy') != null
|
||||||
|
? object
|
||||||
|
.get<ParseObject>('defaultCarbsRatioAccuracy')!
|
||||||
|
.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
defaultPortionSizeAccuracy =
|
||||||
|
object.get<ParseObject>('defaultPortionSizeAccuracy') != null
|
||||||
|
? object
|
||||||
|
.get<ParseObject>('defaultPortionSizeAccuracy')!
|
||||||
|
.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
defaultMealCategory =
|
||||||
|
object.get<ParseObject>('defaultMealCategory') != null
|
||||||
|
? object
|
||||||
|
.get<ParseObject>('defaultMealCategory')!
|
||||||
|
.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
defaultMealPortionType =
|
||||||
|
object.get<ParseObject>('defaultMealPortionType') != null
|
||||||
|
? object
|
||||||
|
.get<ParseObject>('defaultMealPortionType')!
|
||||||
|
.get<String>('objectId')
|
||||||
|
: null;
|
||||||
|
notes = object.get<String>('notes');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<List<MealSource>> fetchAll() async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('MealSource'));
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return apiResponse.results!
|
||||||
|
.map((e) => MealSource(e as ParseObject))
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<MealSource?> get(String objectId) async {
|
||||||
|
QueryBuilder<ParseObject> query =
|
||||||
|
QueryBuilder<ParseObject>(ParseObject('MealSource'))
|
||||||
|
..whereEqualTo('objectId', objectId);
|
||||||
|
final ParseResponse apiResponse = await query.query();
|
||||||
|
|
||||||
|
if (apiResponse.success && apiResponse.results != null) {
|
||||||
|
return MealSource(apiResponse.result.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> save({
|
||||||
|
required String value,
|
||||||
|
String? defaultCarbsRatioAccuracy,
|
||||||
|
String? defaultPortionSizeAccuracy,
|
||||||
|
String? defaultMealCategory,
|
||||||
|
String? defaultMealPortionType,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final mealSource = ParseObject('MealSource')
|
||||||
|
..set('value', value)
|
||||||
|
..set('notes', notes);
|
||||||
|
if (defaultCarbsRatioAccuracy != null) {
|
||||||
|
mealSource.set(
|
||||||
|
'defaultCarbsRatioAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = defaultCarbsRatioAccuracy)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (defaultPortionSizeAccuracy != null) {
|
||||||
|
mealSource.set(
|
||||||
|
'defaultCarbsRatioAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = defaultPortionSizeAccuracy)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (defaultMealCategory != null) {
|
||||||
|
mealSource.set(
|
||||||
|
'defaultMealCategory',
|
||||||
|
(ParseObject('MealCategory')..objectId = defaultMealCategory)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (defaultMealPortionType != null) {
|
||||||
|
mealSource.set(
|
||||||
|
'defaultMealPortionType',
|
||||||
|
(ParseObject('MealPortionType')..objectId = defaultMealPortionType)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
await mealSource.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> update(
|
||||||
|
String objectId, {
|
||||||
|
String? value,
|
||||||
|
String? defaultCarbsRatioAccuracy,
|
||||||
|
String? defaultPortionSizeAccuracy,
|
||||||
|
String? defaultMealCategory,
|
||||||
|
String? defaultMealPortionType,
|
||||||
|
String? notes,
|
||||||
|
}) async {
|
||||||
|
final mealSource = ParseObject('MealSource')..objectId = objectId;
|
||||||
|
if (value != null) {
|
||||||
|
mealSource.set('value', value);
|
||||||
|
}
|
||||||
|
if (defaultCarbsRatioAccuracy != null) {
|
||||||
|
mealSource.set(
|
||||||
|
'defaultCarbsRatioAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = defaultCarbsRatioAccuracy)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (defaultPortionSizeAccuracy != null) {
|
||||||
|
mealSource.set(
|
||||||
|
'defaultCarbsRatioAccuracy',
|
||||||
|
(ParseObject('Accuracy')..objectId = defaultPortionSizeAccuracy)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (defaultMealCategory != null) {
|
||||||
|
mealSource.set(
|
||||||
|
'defaultMealCategory',
|
||||||
|
(ParseObject('MealCategory')..objectId = defaultMealCategory)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (defaultMealPortionType != null) {
|
||||||
|
mealSource.set(
|
||||||
|
'defaultMealPortionType',
|
||||||
|
(ParseObject('MealPortionType')..objectId = defaultMealPortionType)
|
||||||
|
.toPointer());
|
||||||
|
}
|
||||||
|
if (notes != null) {
|
||||||
|
mealSource.set('notes', notes);
|
||||||
|
}
|
||||||
|
await mealSource.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delete() async {
|
||||||
|
var mealSource = ParseObject('MealSource')..objectId = objectId;
|
||||||
|
await mealSource.delete();
|
||||||
|
}
|
||||||
|
}
|
182
lib/navigation.dart
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
import 'package:diameter/screens/accuracy_detail.dart';
|
||||||
|
import 'package:diameter/screens/accuracy_list.dart';
|
||||||
|
import 'package:diameter/screens/basal/basal_detail.dart';
|
||||||
|
import 'package:diameter/screens/basal/basal_profile_detail.dart';
|
||||||
|
import 'package:diameter/screens/basal/basal_profiles_list.dart';
|
||||||
|
import 'package:diameter/screens/bolus/bolus_detail.dart';
|
||||||
|
import 'package:diameter/screens/bolus/bolus_profile_detail.dart';
|
||||||
|
import 'package:diameter/screens/bolus/bolus_profile_list.dart';
|
||||||
|
import 'package:diameter/screens/log/log.dart';
|
||||||
|
import 'package:diameter/screens/log/log_entry.dart';
|
||||||
|
import 'package:diameter/screens/log/log_event_detail.dart';
|
||||||
|
import 'package:diameter/screens/log/log_event_type_detail.dart';
|
||||||
|
import 'package:diameter/screens/log/log_event_type_list.dart';
|
||||||
|
import 'package:diameter/screens/log/log_meal_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_category_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_category_list.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_list.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_portion_type_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_portion_type_list.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_source_detail.dart';
|
||||||
|
import 'package:diameter/screens/meal/meal_source_list.dart';
|
||||||
|
import 'package:diameter/settings.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class Routes {
|
||||||
|
static const String basal = BasalDetailScreen.routeName;
|
||||||
|
static const String basalProfile = BasalProfileDetailScreen.routeName;
|
||||||
|
static const String basalProfiles = BasalProfileListScreen.routeName;
|
||||||
|
static const List<String> basalRoutes = [basal, basalProfile, basalProfiles];
|
||||||
|
|
||||||
|
static const String bolus = BolusDetailScreen.routeName;
|
||||||
|
static const String bolusProfile = BolusProfileDetailScreen.routeName;
|
||||||
|
static const String bolusProfiles = BolusProfileListScreen.routeName;
|
||||||
|
static const List<String> bolusRoutes = [bolus, bolusProfile, bolusProfiles];
|
||||||
|
|
||||||
|
static const String log = LogScreen.routeName;
|
||||||
|
static const String logEntry = LogEntryScreen.routeName;
|
||||||
|
static const String logEvent = LogEventDetailScreen.routeName;
|
||||||
|
static const String logMeal = LogMealDetailScreen.routeName;
|
||||||
|
static const List<String> logEntryRoutes = [logEntry, logEvent, logMeal];
|
||||||
|
static const String logEventType = LogEventTypeDetailScreen.routeName;
|
||||||
|
static const String logEventTypes = LogEventTypeListScreen.routeName;
|
||||||
|
static const List<String> logEventTypeRoutes = [logEventType, logEventTypes];
|
||||||
|
|
||||||
|
static const String meal = MealDetailScreen.routeName;
|
||||||
|
static const String meals = MealListScreen.routeName;
|
||||||
|
static const List<String> mealRoutes = [meal, meals];
|
||||||
|
static const String mealCategory = MealCategoryDetailScreen.routeName;
|
||||||
|
static const String mealCategories = MealCategoryListScreen.routeName;
|
||||||
|
static const List<String> mealCategoryRoutes = [mealCategory, mealCategories];
|
||||||
|
static const String mealPortionType = MealPortionTypeDetailScreen.routeName;
|
||||||
|
static const String mealPortionTypes = MealPortionTypeListScreen.routeName;
|
||||||
|
static const List<String> mealPortionTypeRoutes = [
|
||||||
|
mealPortionType,
|
||||||
|
mealPortionTypes
|
||||||
|
];
|
||||||
|
static const String mealSource = MealSourceDetailScreen.routeName;
|
||||||
|
static const String mealSources = MealSourceListScreen.routeName;
|
||||||
|
static const List<String> mealSourceRoutes = [mealSource, mealSources];
|
||||||
|
|
||||||
|
static const String accuracy = AccuracyDetailScreen.routeName;
|
||||||
|
static const String accuracies = AccuracyListScreen.routeName;
|
||||||
|
static const List<String> accuracyRoutes = [accuracy, accuracies];
|
||||||
|
|
||||||
|
static const String settings = SettingsScreen.routeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Navigation extends StatefulWidget {
|
||||||
|
final String? currentLocation;
|
||||||
|
const Navigation({Key? key, this.currentLocation}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<Navigation> createState() => _NavigationState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NavigationState extends State<Navigation> {
|
||||||
|
void selectDestination(String destination) {
|
||||||
|
Navigator.pushReplacementNamed(context, destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Drawer(
|
||||||
|
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
|
||||||
|
const SizedBox(
|
||||||
|
child: UserAccountsDrawerHeader(
|
||||||
|
accountName: Text('Sarah'),
|
||||||
|
accountEmail: Text('sarah@sudo.ca'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Log'),
|
||||||
|
leading: const Icon(Icons.dashboard),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.log);
|
||||||
|
},
|
||||||
|
selected: widget.currentLocation == Routes.log,
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Log Entry'),
|
||||||
|
leading: const Icon(Icons.description),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.logEntry);
|
||||||
|
},
|
||||||
|
selected: Routes.logEntryRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Meals'),
|
||||||
|
leading: const Icon(Icons.restaurant),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.meals);
|
||||||
|
},
|
||||||
|
selected: Routes.mealRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Meal Categories'),
|
||||||
|
leading: const Icon(Icons.category),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.mealCategories);
|
||||||
|
},
|
||||||
|
selected: Routes.mealCategoryRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Meal Portion Types'),
|
||||||
|
leading: const Icon(Icons.pie_chart),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.mealPortionTypes);
|
||||||
|
},
|
||||||
|
selected: Routes.mealPortionTypeRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Meal Sources'),
|
||||||
|
leading: const Icon(Icons.local_grocery_store),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.mealSources);
|
||||||
|
},
|
||||||
|
selected: Routes.mealSourceRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Accuracies'),
|
||||||
|
leading: const Icon(Icons.architecture),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.accuracies);
|
||||||
|
},
|
||||||
|
selected: Routes.accuracyRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Log Event Types'),
|
||||||
|
leading: const Icon(Icons.event),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.logEventTypes);
|
||||||
|
},
|
||||||
|
selected: Routes.logEventTypeRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Basal Profiles'),
|
||||||
|
leading: const Icon(Icons.access_time),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.basalProfiles);
|
||||||
|
},
|
||||||
|
selected: Routes.basalRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Bolus Profiles'),
|
||||||
|
leading: const Icon(Icons.medication),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.bolusProfiles);
|
||||||
|
},
|
||||||
|
selected: Routes.bolusRoutes.contains(widget.currentLocation),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: const Text('Settings'),
|
||||||
|
leading: const Icon(Icons.settings),
|
||||||
|
onTap: () {
|
||||||
|
selectDestination(Routes.settings);
|
||||||
|
},
|
||||||
|
selected: widget.currentLocation == Routes.settings,
|
||||||
|
)
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
161
lib/screens/accuracy_detail.dart
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
import 'package:diameter/components/detail.dart';
|
||||||
|
import 'package:diameter/components/dialogs.dart';
|
||||||
|
import 'package:diameter/config.dart';
|
||||||
|
import 'package:diameter/navigation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:diameter/components/forms.dart';
|
||||||
|
import 'package:diameter/models/accuracy.dart';
|
||||||
|
|
||||||
|
class AccuracyDetailScreen extends StatefulWidget {
|
||||||
|
static const String routeName = '/accuracy';
|
||||||
|
final Accuracy? accuracy;
|
||||||
|
|
||||||
|
const AccuracyDetailScreen({Key? key, this.accuracy}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AccuracyDetailScreenState createState() => _AccuracyDetailScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AccuracyDetailScreenState extends State<AccuracyDetailScreen> {
|
||||||
|
final GlobalKey<FormState> _accuracyForm = GlobalKey<FormState>();
|
||||||
|
final _valueController = TextEditingController(text: '');
|
||||||
|
final _confidenceRatingController = TextEditingController(text: '');
|
||||||
|
final _notesController = TextEditingController(text: '');
|
||||||
|
bool _forCarbsRatio = false;
|
||||||
|
bool _forPortionSize = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.accuracy != null) {
|
||||||
|
_valueController.text = widget.accuracy!.value;
|
||||||
|
_forCarbsRatio = widget.accuracy!.forCarbsRatio;
|
||||||
|
_forPortionSize = widget.accuracy!.forPortionSize;
|
||||||
|
_confidenceRatingController.text =
|
||||||
|
(widget.accuracy!.confidenceRating ?? '').toString();
|
||||||
|
_notesController.text = widget.accuracy!.notes ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleSaveAction() async {
|
||||||
|
if (_accuracyForm.currentState!.validate()) {
|
||||||
|
bool isNew = widget.accuracy == null;
|
||||||
|
isNew
|
||||||
|
? await Accuracy.save(
|
||||||
|
value: _valueController.text,
|
||||||
|
forCarbsRatio: _forCarbsRatio,
|
||||||
|
forPortionSize: _forPortionSize,
|
||||||
|
confidenceRating: int.tryParse(_confidenceRatingController.text),
|
||||||
|
notes: _notesController.text,
|
||||||
|
)
|
||||||
|
: await Accuracy.update(
|
||||||
|
widget.accuracy!.objectId!,
|
||||||
|
value: _valueController.text,
|
||||||
|
forCarbsRatio: _forCarbsRatio,
|
||||||
|
forPortionSize: _forPortionSize,
|
||||||
|
confidenceRating: int.tryParse(_confidenceRatingController.text),
|
||||||
|
notes: _notesController.text,
|
||||||
|
);
|
||||||
|
Navigator.pop(context, '${isNew ? 'New' : ''} Accuracy saved');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleCancelAction() {
|
||||||
|
bool isNew = widget.accuracy == null;
|
||||||
|
|
||||||
|
if (showConfirmationDialogOnCancel &&
|
||||||
|
(isNew &&
|
||||||
|
(_forCarbsRatio ||
|
||||||
|
_forPortionSize ||
|
||||||
|
_valueController.text != '' ||
|
||||||
|
int.tryParse(_confidenceRatingController.text) != null ||
|
||||||
|
_notesController.text != '')) ||
|
||||||
|
(!isNew &&
|
||||||
|
(_forCarbsRatio != widget.accuracy!.forCarbsRatio ||
|
||||||
|
_forPortionSize != widget.accuracy!.forPortionSize ||
|
||||||
|
widget.accuracy!.value != _valueController.text ||
|
||||||
|
int.tryParse(_confidenceRatingController.text) !=
|
||||||
|
widget.accuracy!.confidenceRating ||
|
||||||
|
(widget.accuracy!.notes ?? '') != _notesController.text))) {
|
||||||
|
Dialogs.showCancelConfirmationDialog(
|
||||||
|
context: context,
|
||||||
|
isNew: isNew,
|
||||||
|
onSave: handleSaveAction,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
bool isNew = widget.accuracy == null;
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(isNew ? 'New Accuracy' : widget.accuracy!.value),
|
||||||
|
),
|
||||||
|
drawer: const Navigation(currentLocation: AccuracyDetailScreen.routeName),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: <Widget>[
|
||||||
|
StyledForm(
|
||||||
|
formState: _accuracyForm,
|
||||||
|
fields: [
|
||||||
|
TextFormField(
|
||||||
|
controller: _valueController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Name',
|
||||||
|
),
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.trim().isEmpty) {
|
||||||
|
return 'Empty name';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
StyledBooleanFormField(
|
||||||
|
value: _forCarbsRatio,
|
||||||
|
label: 'for carbs ratio',
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_forCarbsRatio = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
StyledBooleanFormField(
|
||||||
|
value: _forPortionSize,
|
||||||
|
label: 'for portion size',
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_forPortionSize = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: _confidenceRatingController,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Confidence Rating',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: _notesController,
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Notes',
|
||||||
|
alignLabelWithHint: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomNavigationBar: DetailBottomRow(
|
||||||
|
onCancel: handleCancelAction,
|
||||||
|
onSave: handleSaveAction,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
185
lib/screens/accuracy_list.dart
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
import 'package:diameter/components/dialogs.dart';
|
||||||
|
import 'package:diameter/components/progress_indicator.dart';
|
||||||
|
import 'package:diameter/config.dart';
|
||||||
|
import 'package:diameter/navigation.dart';
|
||||||
|
import 'package:diameter/screens/accuracy_detail.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:diameter/models/accuracy.dart';
|
||||||
|
|
||||||
|
class AccuracyListScreen extends StatefulWidget {
|
||||||
|
static const String routeName = '/accuracies';
|
||||||
|
const AccuracyListScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AccuracyListScreenState createState() => _AccuracyListScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AccuracyListScreenState extends State<AccuracyListScreen> {
|
||||||
|
late Future<List<Accuracy>?> _accuracies;
|
||||||
|
|
||||||
|
void refresh({String? message}) {
|
||||||
|
setState(() {
|
||||||
|
_accuracies = Accuracy.fetchAll();
|
||||||
|
});
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
if (message != null) {
|
||||||
|
var snackBar = SnackBar(
|
||||||
|
content: Text(message),
|
||||||
|
duration: const Duration(seconds: 2),
|
||||||
|
);
|
||||||
|
ScaffoldMessenger.of(context)
|
||||||
|
..removeCurrentSnackBar()
|
||||||
|
..showSnackBar(snackBar);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDelete(Accuracy accuracy) {
|
||||||
|
accuracy.delete().then((_) => refresh(message: 'Accuracy deleted'));
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleDeleteAction(Accuracy accuracy) async {
|
||||||
|
if (showConfirmationDialogOnDelete) {
|
||||||
|
Dialogs.showConfirmationDialog(
|
||||||
|
context: context,
|
||||||
|
onConfirm: () => onDelete(accuracy),
|
||||||
|
message: 'Are you sure you want to delete this Accuracy?',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
onDelete(accuracy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleToggleForPortionSizeAction(Accuracy accuracy) async {
|
||||||
|
await Accuracy.update(
|
||||||
|
accuracy.objectId!,
|
||||||
|
forPortionSize: !accuracy.forPortionSize,
|
||||||
|
);
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleToggleForCarbsRatioAction(Accuracy accuracy) async {
|
||||||
|
await Accuracy.update(
|
||||||
|
accuracy.objectId!,
|
||||||
|
forCarbsRatio: !accuracy.forCarbsRatio,
|
||||||
|
);
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Accuracies'),
|
||||||
|
actions: <Widget>[
|
||||||
|
IconButton(onPressed: refresh, icon: const Icon(Icons.refresh))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
drawer: const Navigation(currentLocation: AccuracyListScreen.routeName),
|
||||||
|
body: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: FutureBuilder<List<Accuracy>?>(
|
||||||
|
future: _accuracies,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return ViewWithProgressIndicator(
|
||||||
|
snapshot: snapshot,
|
||||||
|
child: snapshot.data == null || snapshot.data!.isEmpty
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(10.0),
|
||||||
|
child: Text('No Accuracies'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0),
|
||||||
|
itemCount: snapshot.data != null
|
||||||
|
? snapshot.data!.length
|
||||||
|
: 0,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final accuracy = snapshot.data![index];
|
||||||
|
return ListTile(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
AccuracyDetailScreen(
|
||||||
|
accuracy: accuracy),
|
||||||
|
),
|
||||||
|
).then(
|
||||||
|
(message) => refresh(message: message));
|
||||||
|
},
|
||||||
|
title: Text(accuracy.value),
|
||||||
|
leading: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.reorder),
|
||||||
|
onPressed: () {
|
||||||
|
// TODO: implement reordering
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
trailing: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.square_foot,
|
||||||
|
color: accuracy.forPortionSize
|
||||||
|
? Colors.blue
|
||||||
|
: Colors.grey.shade300),
|
||||||
|
onPressed: () =>
|
||||||
|
handleToggleForPortionSizeAction(
|
||||||
|
accuracy)),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.pie_chart,
|
||||||
|
color: accuracy.forCarbsRatio
|
||||||
|
? Colors.blue
|
||||||
|
: Colors.grey.shade300),
|
||||||
|
onPressed: () =>
|
||||||
|
handleToggleForCarbsRatioAction(
|
||||||
|
accuracy),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 24),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: Colors.blue,
|
||||||
|
),
|
||||||
|
onPressed: () =>
|
||||||
|
handleDeleteAction(accuracy),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const AccuracyDetailScreen(),
|
||||||
|
)).then((message) => refresh(message: message));
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.add),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
175
lib/screens/basal/basal_detail.dart
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
import 'package:diameter/components/detail.dart';
|
||||||
|
import 'package:diameter/components/dialogs.dart';
|
||||||
|
import 'package:diameter/config.dart';
|
||||||
|
import 'package:diameter/navigation.dart';
|
||||||
|
import 'package:diameter/utils/date_time_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:diameter/components/forms.dart';
|
||||||
|
import 'package:diameter/models/basal.dart';
|
||||||
|
import 'package:diameter/models/basal_profile.dart';
|
||||||
|
|
||||||
|
class BasalDetailScreen extends StatefulWidget {
|
||||||
|
static const String routeName = '/basal';
|
||||||
|
|
||||||
|
final BasalProfile basalProfile;
|
||||||
|
final Basal? basal;
|
||||||
|
|
||||||
|
const BasalDetailScreen({Key? key, required this.basalProfile, this.basal})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_BasalDetailScreenState createState() => _BasalDetailScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BasalDetailScreenState extends State<BasalDetailScreen> {
|
||||||
|
final GlobalKey<FormState> _basalForm = GlobalKey<FormState>();
|
||||||
|
TimeOfDay _startTime = const TimeOfDay(hour: 0, minute: 0);
|
||||||
|
TimeOfDay _endTime = const TimeOfDay(hour: 0, minute: 0);
|
||||||
|
|
||||||
|
final _startTimeController = TextEditingController(text: '');
|
||||||
|
final _endTimeController = TextEditingController(text: '');
|
||||||
|
final _unitsController = TextEditingController(text: '');
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.basal != null) {
|
||||||
|
_startTime = TimeOfDay.fromDateTime(widget.basal!.startTime);
|
||||||
|
_endTime = TimeOfDay.fromDateTime(widget.basal!.endTime);
|
||||||
|
|
||||||
|
_unitsController.text = widget.basal!.units.toString();
|
||||||
|
}
|
||||||
|
updateStartTime();
|
||||||
|
updateEndTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateStartTime() {
|
||||||
|
_startTimeController.text = DateTimeUtils.displayTimeOfDay(_startTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateEndTime() {
|
||||||
|
_endTimeController.text = DateTimeUtils.displayTimeOfDay(_endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleSaveAction() async {
|
||||||
|
// TODO: add confirmation dialog in case time period is already covered
|
||||||
|
if (_basalForm.currentState!.validate()) {
|
||||||
|
bool isNew = widget.basal == null;
|
||||||
|
isNew
|
||||||
|
? await Basal.save(
|
||||||
|
startTime: DateTimeUtils.convertTimeOfDayToDateTime(_startTime),
|
||||||
|
endTime: DateTimeUtils.convertTimeOfDayToDateTime(_endTime),
|
||||||
|
units: double.parse(_unitsController.text),
|
||||||
|
basalProfile: widget.basalProfile.objectId!,
|
||||||
|
)
|
||||||
|
: await Basal.update(
|
||||||
|
widget.basal!.objectId!,
|
||||||
|
startTime: DateTimeUtils.convertTimeOfDayToDateTime(_startTime),
|
||||||
|
endTime: DateTimeUtils.convertTimeOfDayToDateTime(_endTime),
|
||||||
|
units: double.parse(_unitsController.text),
|
||||||
|
);
|
||||||
|
Navigator.pop(context, '${isNew ? 'New' : ''} Basal Rate saved');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleCancelAction() {
|
||||||
|
bool isNew = widget.basal == null;
|
||||||
|
if (showConfirmationDialogOnCancel &&
|
||||||
|
((isNew &&
|
||||||
|
(_startTime.hour != 0 ||
|
||||||
|
_endTime.hour != 0 ||
|
||||||
|
_startTime.minute != 0 ||
|
||||||
|
_endTime.minute != 0 ||
|
||||||
|
double.tryParse(_unitsController.text) != null)) ||
|
||||||
|
(!isNew &&
|
||||||
|
(TimeOfDay.fromDateTime(widget.basal!.startTime) !=
|
||||||
|
_startTime ||
|
||||||
|
TimeOfDay.fromDateTime(widget.basal!.endTime) != _endTime ||
|
||||||
|
(double.tryParse(_unitsController.text) ?? 0) !=
|
||||||
|
widget.basal!.units)))) {
|
||||||
|
Dialogs.showCancelConfirmationDialog(
|
||||||
|
context: context,
|
||||||
|
isNew: isNew,
|
||||||
|
onSave: handleSaveAction,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
bool isNew = widget.basal == null;
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(
|
||||||
|
'${isNew ? 'New' : 'Edit'} Basal Rate for ${widget.basalProfile.name}'),
|
||||||
|
),
|
||||||
|
drawer: const Navigation(currentLocation: BasalDetailScreen.routeName),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
StyledForm(
|
||||||
|
formState: _basalForm,
|
||||||
|
fields: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: StyledTimeOfDayFormField(
|
||||||
|
label: 'Start Time',
|
||||||
|
controller: _startTimeController,
|
||||||
|
time: _startTime,
|
||||||
|
onChanged: (newStartTime) {
|
||||||
|
if (newStartTime != null) {
|
||||||
|
setState(() {
|
||||||
|
_startTime = newStartTime;
|
||||||
|
});
|
||||||
|
updateStartTime();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: StyledTimeOfDayFormField(
|
||||||
|
label: 'End Time',
|
||||||
|
controller: _endTimeController,
|
||||||
|
time: _endTime,
|
||||||
|
onChanged: (newEndTime) {
|
||||||
|
if (newEndTime != null) {
|
||||||
|
setState(() {
|
||||||
|
_endTime = newEndTime;
|
||||||
|
});
|
||||||
|
updateEndTime();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: _unitsController,
|
||||||
|
keyboardType:
|
||||||
|
const TextInputType.numberWithOptions(decimal: true),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Units',
|
||||||
|
suffixText: 'U',
|
||||||
|
),
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.trim().isEmpty) {
|
||||||
|
return 'Empty amount of units';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
bottomNavigationBar: DetailBottomRow(
|
||||||
|
onCancel: handleCancelAction,
|
||||||
|
onSave: handleSaveAction,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|