Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
3940184975 | |||
eee1d12851 | |||
e11a73d37e | |||
ead31e12c0 | |||
421d19f91f | |||
3085a295e5 | |||
c12ba48e15 | |||
d2b4b6ee71 | |||
40bdcc44f9 | |||
fc35476503 | |||
90f2998088 | |||
b520d56d1a | |||
c580e45361 | |||
238fd6bc6a | |||
478ea644a9 | |||
82fc8c5fbb | |||
c23863903a | |||
65939fba30 | |||
f592e7b66b | |||
9ee29a7c7c | |||
d06d7f1448 | |||
5c2592f601 | |||
c09b164a61 | |||
1826bbe421 | |||
1abfd0c1f5 | |||
763cf9d627 | |||
6dde08d74d | |||
fad8d8b49b | |||
d289cfc4d5 | |||
409ccbcdda | |||
c5e240e813 | |||
44db690a4a | |||
8156b3f529 | |||
58bc713227 |
11
.gitignore
vendored
@ -8,6 +8,7 @@
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
@ -26,19 +27,17 @@
|
||||
.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
|
||||
|
||||
# Exceptions to above rules.
|
||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||
# Android Studio will place build artifacts here
|
||||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
39
.metadata
@ -4,7 +4,42 @@
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: fba99f6cf9a14512e461e3122c8ddfaa25394e89
|
||||
channel: stable
|
||||
revision: "ba393198430278b6595976de84fe170f553cc728"
|
||||
channel: "stable"
|
||||
|
||||
project_type: app
|
||||
|
||||
# Tracks metadata for the flutter migrate command
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
base_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
- platform: android
|
||||
create_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
base_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
- platform: ios
|
||||
create_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
base_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
- platform: linux
|
||||
create_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
base_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
- platform: macos
|
||||
create_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
base_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
- platform: web
|
||||
create_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
base_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
- platform: windows
|
||||
create_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
base_revision: ba393198430278b6595976de84fe170f553cc728
|
||||
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
# ignored by the migrate tool.
|
||||
#
|
||||
# Files that are not part of the templates will be ignored by default.
|
||||
unmanaged_files:
|
||||
- 'lib/main.dart'
|
||||
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||
|
28
README.md
@ -1,8 +1,32 @@
|
||||
# time_progress_tracker
|
||||
# Time Progress Tracker
|
||||
|
||||
A Flutter Application to create Timers with a percentage indicator.
|
||||
The Idea for this Application came to me while, I was doing my civil service.
|
||||
It is a really simple app at this state. You can enter Time Progresses, which are made up of
|
||||
a name, a start date, and a end date.
|
||||
Then you can see a list of all currently active and a list of all currently inactive progresses,
|
||||
including their current percentages.
|
||||
|
||||
## Getting Started
|
||||
## Current State of the repo.
|
||||
|
||||
Currently, the code in this branch is pretty messed up. Since I wrote that application from a
|
||||
prototype which, was developed as my first flutter project and in a very short time.
|
||||
Since, then most of the work that went into this project was cleanup work.
|
||||
|
||||
Currently I am working on a clean codebase in the feature/platform-widget branch.
|
||||
|
||||
At this state, the base screens of the app are located in lib/screens,
|
||||
all other ui widgets are located in li/widgets,
|
||||
the model classes are located in lib/model,
|
||||
files related to persisting the data are in lib/persistence,
|
||||
and redux related files are spread over lib/actions lib/middleware lib/reducers and lib/reducers.
|
||||
|
||||
- [Google Play](https://play.google.com/store/apps/details?id=com.fahrecker.time_progress_calculator)
|
||||
|
||||
|
||||
## Original Readme
|
||||
|
||||
### Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
|
28
analysis_options.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
# included above or to enable additional rules. A list of all available lints
|
||||
# and their documentation is published at https://dart.dev/lints.
|
||||
#
|
||||
# Instead of disabling a lint rule for the entire project in the
|
||||
# section below, it can also be suppressed for a single line of code
|
||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
2
android/.gitignore
vendored
@ -9,3 +9,5 @@ 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
|
||||
|
@ -1,3 +1,9 @@
|
||||
plugins {
|
||||
id "com.android.application"
|
||||
id "kotlin-android"
|
||||
id "dev.flutter.flutter-gradle-plugin"
|
||||
}
|
||||
|
||||
def localProperties = new Properties()
|
||||
def localPropertiesFile = rootProject.file('local.properties')
|
||||
if (localPropertiesFile.exists()) {
|
||||
@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
|
||||
}
|
||||
}
|
||||
|
||||
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'
|
||||
@ -21,10 +22,6 @@ if (flutterVersionName == null) {
|
||||
flutterVersionName = '1.0'
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
|
||||
def keystoreProperties = new Properties()
|
||||
def keystorePropertiesFile = rootProject.file('key.properties')
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
@ -32,21 +29,30 @@ if (keystorePropertiesFile.exists()) {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
namespace "com.fahrecker.time_progress_calculator"
|
||||
compileSdk flutter.compileSdkVersion
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
disable 'InvalidPackage'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.fahrecker.time_progress_calculator"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
targetSdkVersion flutter.targetSdkVersion
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
}
|
||||
@ -71,6 +77,4 @@ flutter {
|
||||
source '../..'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
}
|
||||
dependencies {}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.fahrecker.time_progress_calculator">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
@ -1,16 +1,12 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.fahrecker.time_progress_calculator">
|
||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||
calls FlutterMain.startInitialization(this); in its onCreate method.
|
||||
In most cases you can leave this as-is, but you if you want to provide
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="Time Progress Tracker"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
@ -24,15 +20,6 @@
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<!-- Displays an Android View that continues showing the launch screen
|
||||
Drawable until Flutter paints its first frame, then this splash
|
||||
screen fades out. A splash screen is useful to avoid any visual
|
||||
gap between the end of Android's launch screen and the painting of
|
||||
Flutter's first frame. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.SplashScreenDrawable"
|
||||
android:resource="@drawable/launch_background"
|
||||
/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
@ -44,4 +31,15 @@
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility?hl=en and
|
||||
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
|
||||
|
||||
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
|
@ -0,0 +1,6 @@
|
||||
package com.fahrecker.time_progress_tracker
|
||||
|
||||
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>
|
BIN
android/app/src/main/res/mipmap-hdpi/android_1024.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 5.7 KiB |
BIN
android/app/src/main/res/mipmap-mdpi/android_1024.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
android/app/src/main/res/mipmap-xhdpi/android_1024.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 7.8 KiB |
BIN
android/app/src/main/res/mipmap-xxhdpi/android_1024.png
Normal file
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 13 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/android_1024.png
Normal file
After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 19 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
|
||||
the Flutter engine 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>
|
@ -1,18 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<!-- 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 -->
|
||||
the Flutter engine 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:color/white</item>
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">?android:colorBackground</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.fahrecker.time_progress_calculator">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
@ -1,20 +1,7 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.50'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +13,6 @@ subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.enableR8=true
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
@ -1,6 +1,5 @@
|
||||
#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-5.6.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
|
||||
|
@ -1,11 +1,26 @@
|
||||
include ':app'
|
||||
pluginManagement {
|
||||
def flutterSdkPath = {
|
||||
def properties = new Properties()
|
||||
file("local.properties").withInputStream { properties.load(it) }
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||
return flutterSdkPath
|
||||
}
|
||||
settings.ext.flutterSdkPath = flutterSdkPath()
|
||||
|
||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
||||
def properties = new Properties()
|
||||
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
|
||||
|
||||
assert localPropertiesFile.exists()
|
||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
plugins {
|
||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||
id "com.android.application" version "7.3.0" apply false
|
||||
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
|
||||
}
|
||||
|
||||
include ":app"
|
||||
|
Before Width: | Height: | Size: 5.6 KiB |
BIN
assets/logo/android_1024.png
Executable file
After Width: | Height: | Size: 133 KiB |
BIN
assets/logo/ios_1024.png
Executable file
After Width: | Height: | Size: 115 KiB |
@ -1,4 +1,5 @@
|
||||
flutter_icons:
|
||||
android: true
|
||||
ios: false
|
||||
image_path: "assets/icons/launcher_icon.png"
|
||||
ios: true
|
||||
image_path_android: "assets/logo/android_1024.png"
|
||||
image_path_ios: "assets/logo/ios_1024.png"
|
2
ios/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
**/dgph
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.moved-aside
|
||||
@ -18,6 +19,7 @@ Flutter/App.framework
|
||||
Flutter/Flutter.framework
|
||||
Flutter/Flutter.podspec
|
||||
Flutter/Generated.xcconfig
|
||||
Flutter/ephemeral/
|
||||
Flutter/app.flx
|
||||
Flutter/app.zip
|
||||
Flutter/flutter_assets/
|
||||
|
@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>App</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@ -21,6 +21,6 @@
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
<string>12.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -1 +1,2 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
@ -1 +1,3 @@
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
41
ios/Podfile
Normal file
@ -0,0 +1,41 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
platform :ios, '9.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
use_modular_headers!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
@ -3,14 +3,14 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objectVersion = 51;
|
||||
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 */; };
|
||||
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
|
||||
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
|
||||
6186AFFAE7FCA76C81CF360E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D5EAE1ADE1FFBE7D23EE84E /* Pods_Runner.framework */; };
|
||||
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 */; };
|
||||
@ -32,18 +32,21 @@
|
||||
/* 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>"; };
|
||||
1DBA7F16BF734A3CE98E5546 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<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>"; };
|
||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
7D5EAE1ADE1FFBE7D23EE84E /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
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; };
|
||||
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
B4DFA246891E5346CCC8628F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
DC45E65269FD602449E1FEBD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -51,12 +54,23 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6186AFFAE7FCA76C81CF360E /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
7425B1E33E3BCBE464E2CBB5 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B4DFA246891E5346CCC8628F /* Pods-Runner.debug.xcconfig */,
|
||||
1DBA7F16BF734A3CE98E5546 /* Pods-Runner.release.xcconfig */,
|
||||
DC45E65269FD602449E1FEBD /* Pods-Runner.profile.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -74,7 +88,8 @@
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
|
||||
7425B1E33E3BCBE464E2CBB5 /* Pods */,
|
||||
E3A24E042363B3BCA7910470 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@ -89,25 +104,24 @@
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
|
||||
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
97C147021CF9000F007C117D /* Info.plist */,
|
||||
97C146F11CF9000F007C117D /* Supporting Files */,
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
97C146F11CF9000F007C117D /* Supporting Files */ = {
|
||||
E3A24E042363B3BCA7910470 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146F21CF9000F007C117D /* main.m */,
|
||||
7D5EAE1ADE1FFBE7D23EE84E /* Pods_Runner.framework */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
@ -117,12 +131,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
A60954191C254DCAC69F1735 /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
555CAADD55712EED12802136 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -144,6 +160,7 @@
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -194,6 +211,23 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
555CAADD55712EED12802136 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -208,6 +242,28 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
A60954191C254DCAC69F1735 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@ -215,8 +271,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
|
||||
97C146F31CF9000F007C117D /* main.m in Sources */,
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -284,7 +339,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
@ -298,20 +353,19 @@
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = RD9K843SK5;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.fahrecker.timeProgressCalculator;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.fahrecker.timeProgressTracker;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Profile;
|
||||
@ -363,7 +417,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@ -412,10 +466,12 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
@ -426,20 +482,20 @@
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = RD9K843SK5;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.fahrecker.timeProgressCalculator;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.fahrecker.timeProgressTracker;
|
||||
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;
|
||||
@ -449,20 +505,19 @@
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = RD9K843SK5;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
);
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Flutter",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.fahrecker.timeProgressCalculator;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.fahrecker.timeProgressTracker;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2,6 +2,6 @@
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
LastUpgradeVersion = "1510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -27,8 +27,6 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
@ -38,8 +36,19 @@
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
parallelizable = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "331C8080294A63A400263BE5"
|
||||
BuildableName = "RunnerTests.xctest"
|
||||
BlueprintName = "RunnerTests"
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@ -61,8 +70,6 @@
|
||||
ReferencedContainer = "container:Runner.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Profile"
|
||||
|
3
ios/Runner.xcworkspace/contents.xcworkspacedata
generated
@ -4,4 +4,7 @@
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
@ -1,6 +0,0 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : FlutterAppDelegate
|
||||
|
||||
@end
|
@ -1,13 +0,0 @@
|
||||
#import "AppDelegate.h"
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
[GeneratedPluginRegistrant registerWithRegistry:self];
|
||||
// Override point for customization after application launch.
|
||||
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
||||
}
|
||||
|
||||
@end
|
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)
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 896 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 14 KiB |
@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Time Progress Tracker</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@ -11,7 +13,7 @@
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>time_progress_calculator</string>
|
||||
<string>time_progress_tracker</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
@ -39,7 +41,9 @@
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
1
ios/Runner/Runner-Bridging-Header.h
Normal file
@ -0,0 +1 @@
|
||||
#import "GeneratedPluginRegistrant.h"
|
@ -1,9 +0,0 @@
|
||||
#import <Flutter/Flutter.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
12
ios/RunnerTests/RunnerTests.swift
Normal file
@ -0,0 +1,12 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
import XCTest
|
||||
|
||||
class RunnerTests: XCTestCase {
|
||||
|
||||
func testExample() {
|
||||
// If you add code to the Runner application, consider adding tests here.
|
||||
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,24 @@
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/models/app_settings.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
|
||||
class LoadSettingsAction {}
|
||||
|
||||
class AppSettingsLoadedActions {
|
||||
final AppSettings appSettings;
|
||||
|
||||
AppSettingsLoadedActions(this.appSettings);
|
||||
}
|
||||
|
||||
class UpdateAppSettingsActions {
|
||||
final AppSettings appSettings;
|
||||
|
||||
UpdateAppSettingsActions(this.appSettings);
|
||||
}
|
||||
|
||||
class AppSettingsNotLoadedAction {}
|
||||
|
||||
class LoadTimeProgressListAction {}
|
||||
|
||||
class TimeProgressListLoadedAction {
|
||||
@ -32,7 +49,11 @@ class DeleteTimeProgressAction {
|
||||
}
|
||||
|
||||
void loadTimeProgressListIfUnloaded(Store<AppState> store) {
|
||||
if (!store.state.hasLoaded) {
|
||||
if (!store.state.hasProgressesLoaded) {
|
||||
store.dispatch(LoadTimeProgressListAction());
|
||||
}
|
||||
}
|
||||
|
||||
void loadSettingsIfUnloaded(Store<AppState> store) {
|
||||
if (!store.state.hasSettingsLoaded) store.dispatch(LoadSettingsAction());
|
||||
}
|
||||
|
35
lib/app.dart
@ -3,20 +3,18 @@ import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_creation_screen.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_dashboard_screen.dart';
|
||||
import 'package:time_progress_tracker/screens/home_screen.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_detail_screen.dart';
|
||||
|
||||
class TimeProgressTrackerApp extends StatelessWidget {
|
||||
static const String name = "Time Progress Tracker";
|
||||
|
||||
final Store<AppState> store;
|
||||
final String appVersion;
|
||||
|
||||
TimeProgressTrackerApp({
|
||||
Key key,
|
||||
this.store,
|
||||
this.appVersion,
|
||||
}) : super(key: key);
|
||||
const TimeProgressTrackerApp({
|
||||
super.key,
|
||||
required this.store,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -25,23 +23,22 @@ class TimeProgressTrackerApp extends StatelessWidget {
|
||||
child: MaterialApp(
|
||||
title: name,
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
primarySwatch: Colors.indigo,
|
||||
colorScheme: ColorScheme.fromSwatch(
|
||||
primarySwatch: Colors.indigo,
|
||||
accentColor: Colors.indigoAccent,
|
||||
backgroundColor: Colors.white
|
||||
),
|
||||
brightness: Brightness.light,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
),
|
||||
initialRoute: ProgressDashboardScreen.routeName,
|
||||
initialRoute: HomeScreen.routeName,
|
||||
routes: {
|
||||
ProgressDashboardScreen.routeName: (BuildContext context) =>
|
||||
ProgressDashboardScreen(
|
||||
appVersion: appVersion,
|
||||
),
|
||||
HomeScreen.routeName: (BuildContext context) => const HomeScreen(),
|
||||
ProgressDetailScreen.routeName: (BuildContext context) =>
|
||||
ProgressDetailScreen(
|
||||
appVersion: appVersion,
|
||||
),
|
||||
const ProgressDetailScreen(),
|
||||
ProgressCreationScreen.routeName: (BuildContext context) =>
|
||||
ProgressCreationScreen(
|
||||
appVersion: appVersion,
|
||||
),
|
||||
const ProgressCreationScreen(),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
17
lib/helper_functions.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
|
||||
TimeProgress selectProgressById(List<TimeProgress> tpList, String id) =>
|
||||
tpList.firstWhere((tp) => tp.id == id, orElse: () => TimeProgress.initialDefault());
|
||||
|
||||
List<TimeProgress> selectActiveProgresses(List<TimeProgress> tpList) =>
|
||||
tpList.where((tp) => tp.hasStarted() && !tp.hasEnded()).toList();
|
||||
|
||||
List<TimeProgress> selectInactiveProgresses(List<TimeProgress> tpList) =>
|
||||
tpList.where((tp) => !tp.hasStarted() || tp.hasEnded()).toList();
|
||||
|
||||
bool useBrightBackground(Color bC) {
|
||||
double yiq = ((bC.red * 299) + (bC.green * 587) + (bC.blue * 114)) / 1000;
|
||||
return yiq >= 186 || (bC.red == 0 && bC.green == 0 && bC.blue == 0);
|
||||
}
|
@ -1,24 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:time_progress_tracker/app.dart';
|
||||
import 'package:time_progress_tracker/middleware/store_time_progress_middleware.dart';
|
||||
import 'package:time_progress_tracker/middleware/store_middleware.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/persistence/app_settings.dart';
|
||||
import 'package:time_progress_tracker/persistence/time_progress_repository.dart';
|
||||
import 'package:time_progress_tracker/reducers/app_state_reducer.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
runApp(TimeProgressTrackerApp(
|
||||
store: Store<AppState>(
|
||||
appStateReducer,
|
||||
initialState: AppState.initial(),
|
||||
middleware: createStoreTimeProgressListMiddleware(
|
||||
TimeProgressRepository(await SharedPreferences.getInstance()),
|
||||
),
|
||||
middleware: createStoreMiddleware(
|
||||
TimeProgressRepository(prefs), AppSettingsRepository(prefs)),
|
||||
),
|
||||
appVersion: (await PackageInfo.fromPlatform()).version,
|
||||
));
|
||||
}
|
||||
|
@ -1,21 +1,28 @@
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
import 'package:time_progress_tracker/models/app_settings.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
import 'package:time_progress_tracker/persistence/app_settings.dart';
|
||||
import 'package:time_progress_tracker/persistence/time_progress_entity.dart';
|
||||
import 'package:time_progress_tracker/persistence/time_progress_repository.dart';
|
||||
import 'package:time_progress_tracker/selectors/time_progress_selectors.dart';
|
||||
|
||||
List<Middleware<AppState>> createStoreTimeProgressListMiddleware(
|
||||
TimeProgressRepository repository) {
|
||||
final saveTimeProgressList = _createSaveTimeProgressList(repository);
|
||||
final loadTimeProgressList = _createLoadTimeProgressList(repository);
|
||||
List<Middleware<AppState>> createStoreMiddleware(
|
||||
TimeProgressRepository progressRepo, AppSettingsRepository settingsRepo) {
|
||||
final saveTimeProgressList = _createSaveTimeProgressList(progressRepo);
|
||||
final loadTimeProgressList = _createLoadTimeProgressList(progressRepo);
|
||||
|
||||
final saveSettings = _createSaveAppSettings(settingsRepo);
|
||||
final loadSettings = _createLoadAppSettings(settingsRepo);
|
||||
|
||||
return [
|
||||
TypedMiddleware<AppState, LoadTimeProgressListAction>(loadTimeProgressList),
|
||||
TypedMiddleware<AppState, AddTimeProgressAction>(saveTimeProgressList),
|
||||
TypedMiddleware<AppState, UpdateTimeProgressAction>(saveTimeProgressList),
|
||||
TypedMiddleware<AppState, DeleteTimeProgressAction>(saveTimeProgressList),
|
||||
TypedMiddleware<AppState, LoadTimeProgressListAction>(loadTimeProgressList).call,
|
||||
TypedMiddleware<AppState, AddTimeProgressAction>(saveTimeProgressList).call,
|
||||
TypedMiddleware<AppState, UpdateTimeProgressAction>(saveTimeProgressList).call,
|
||||
TypedMiddleware<AppState, DeleteTimeProgressAction>(saveTimeProgressList).call,
|
||||
TypedMiddleware<AppState, LoadSettingsAction>(loadSettings).call,
|
||||
TypedMiddleware<AppState, UpdateAppSettingsActions>(saveSettings).call
|
||||
];
|
||||
}
|
||||
|
||||
@ -38,12 +45,23 @@ Middleware<AppState> _createLoadTimeProgressList(
|
||||
repository.loadTimeProgressList().then((timeProgresses) {
|
||||
List<TimeProgress> timeProgressList =
|
||||
timeProgresses.map<TimeProgress>(TimeProgress.fromEntity).toList();
|
||||
if (timeProgressList == null) {
|
||||
timeProgressList = [];
|
||||
}
|
||||
store.dispatch(TimeProgressListLoadedAction(
|
||||
timeProgressList,
|
||||
));
|
||||
}).catchError((_) => store.dispatch(TimeProgressListNotLoadedAction()));
|
||||
};
|
||||
}
|
||||
|
||||
Middleware<AppState> _createSaveAppSettings(AppSettingsRepository repo) =>
|
||||
(Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
next(action);
|
||||
repo.saveAppSettings(store.state.appSettings.toEntity());
|
||||
};
|
||||
|
||||
Middleware<AppState> _createLoadAppSettings(AppSettingsRepository repo) =>
|
||||
(Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
repo.loadAppSettings().then((appSettings) {
|
||||
store.dispatch(
|
||||
AppSettingsLoadedActions(AppSettings.fromEntity(appSettings)));
|
||||
});
|
||||
};
|
@ -1,7 +1,31 @@
|
||||
class TimeProgressInvalidNameException implements Exception {
|
||||
final invalidName;
|
||||
final String invalidName;
|
||||
|
||||
TimeProgressInvalidNameException(this.invalidName);
|
||||
|
||||
String errMsg() => "The name of a TimeProgress can't be: $invalidName";
|
||||
}
|
||||
|
||||
class TimeProgressStartTimeIsNotBeforeEndTimeException implements Exception {
|
||||
final DateTime startTime;
|
||||
final DateTime endTime;
|
||||
|
||||
TimeProgressStartTimeIsNotBeforeEndTimeException(
|
||||
this.startTime, this.endTime);
|
||||
|
||||
String errMsg() =>
|
||||
"The Start Time has to be before the end time. Therefore these values are"
|
||||
" invalid: Start Time: $startTime EndTime: $endTime";
|
||||
}
|
||||
|
||||
class TimeProgressHasStartedException implements Exception {
|
||||
String errMsg() =>
|
||||
"This TimeProgress has started. Therefore all calculation, which assume, "
|
||||
"that the progress hasn't started yet can't be performed";
|
||||
}
|
||||
|
||||
class TimeProgressHasNotEndedException implements Exception {
|
||||
String errMsg() =>
|
||||
"This TimeProgress hasn't ended. Therefore all calculation, which assume,"
|
||||
" that the progress has ended already can't be performed";
|
||||
}
|
||||
|
54
lib/models/app_settings.dart
Normal file
@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/persistence/app_settings.dart';
|
||||
|
||||
@immutable
|
||||
class AppSettings {
|
||||
final Color doneColor;
|
||||
final Color leftColor;
|
||||
final Duration duration;
|
||||
|
||||
const AppSettings({
|
||||
required this.doneColor,
|
||||
required this.leftColor,
|
||||
required this.duration,
|
||||
});
|
||||
|
||||
factory AppSettings.defaults() => const AppSettings(
|
||||
doneColor: Colors.green,
|
||||
leftColor: Colors.red,
|
||||
duration: Duration(days: 365),
|
||||
);
|
||||
|
||||
AppSettings copyWith({
|
||||
Color? doneColor,
|
||||
Color? leftColor,
|
||||
Duration? duration,
|
||||
}) =>
|
||||
AppSettings(
|
||||
doneColor: doneColor ?? this.doneColor,
|
||||
leftColor: leftColor ?? this.leftColor,
|
||||
duration: duration ?? this.duration,
|
||||
);
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
doneColor.hashCode ^ leftColor.hashCode ^ duration.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AppSettings &&
|
||||
runtimeType == other.runtimeType &&
|
||||
doneColor == other.doneColor &&
|
||||
leftColor == other.leftColor &&
|
||||
duration == other.duration;
|
||||
|
||||
AppSettingsEntity toEntity() =>
|
||||
AppSettingsEntity(doneColor.value, leftColor.value, duration.inDays);
|
||||
|
||||
static AppSettings fromEntity(AppSettingsEntity entity) => AppSettings(
|
||||
doneColor: Color(entity.doneColorValue),
|
||||
leftColor: Color(entity.leftColorValue),
|
||||
duration: Duration(days: entity.durationDays),
|
||||
);
|
||||
}
|
@ -1,36 +1,42 @@
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:time_progress_tracker/models/app_settings.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
|
||||
@immutable
|
||||
class AppState {
|
||||
final bool hasLoaded;
|
||||
final bool hasProgressesLoaded, hasSettingsLoaded;
|
||||
final List<TimeProgress> timeProgressList;
|
||||
final AppSettings appSettings;
|
||||
|
||||
AppState({
|
||||
this.hasLoaded = false,
|
||||
this.timeProgressList = const [],
|
||||
});
|
||||
const AppState(
|
||||
{this.hasProgressesLoaded = false,
|
||||
this.hasSettingsLoaded = false,
|
||||
this.timeProgressList = const [],
|
||||
required this.appSettings});
|
||||
|
||||
factory AppState.initial() => AppState(hasLoaded: false);
|
||||
factory AppState.initial() =>
|
||||
AppState(hasProgressesLoaded: false, appSettings: AppSettings.defaults());
|
||||
|
||||
AppState copyWith({
|
||||
bool hasLoaded,
|
||||
List<TimeProgress> timeProgressList,
|
||||
bool? hasLoaded,
|
||||
List<TimeProgress>? timeProgressList,
|
||||
AppSettings? appSettings,
|
||||
}) {
|
||||
return AppState(
|
||||
hasLoaded: hasLoaded ?? this.hasLoaded,
|
||||
hasProgressesLoaded: hasLoaded ?? hasProgressesLoaded,
|
||||
timeProgressList: timeProgressList ?? this.timeProgressList,
|
||||
appSettings: appSettings ?? this.appSettings,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => hasLoaded.hashCode ^ timeProgressList.hashCode;
|
||||
int get hashCode => hasProgressesLoaded.hashCode ^ timeProgressList.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AppState &&
|
||||
runtimeType == other.runtimeType &&
|
||||
hasLoaded == other.hasLoaded &&
|
||||
hasProgressesLoaded == other.hasProgressesLoaded &&
|
||||
timeProgressList == other.timeProgressList;
|
||||
}
|
||||
|
@ -10,42 +10,54 @@ class TimeProgress {
|
||||
final DateTime startTime;
|
||||
final DateTime endTime;
|
||||
|
||||
TimeProgress(this.name, this.startTime, this.endTime, {String id})
|
||||
: id = id ?? Uuid().generateV4() {
|
||||
if (this.name == null || this.name == "") {
|
||||
throw new TimeProgressInvalidNameException(this.name);
|
||||
}
|
||||
}
|
||||
TimeProgress(this.name, this.startTime, this.endTime, {String? id})
|
||||
: id = id ?? Uuid().generateV4();
|
||||
|
||||
factory TimeProgress.initialDefault() {
|
||||
int thisYear = DateTime.now().year;
|
||||
return TimeProgress("Initial Name", DateTime(thisYear - 1), DateTime(thisYear + 1));
|
||||
return TimeProgress(
|
||||
"Initial Name", DateTime(thisYear - 1), DateTime(thisYear + 1));
|
||||
}
|
||||
|
||||
factory TimeProgress.defaultFromDuration(Duration duration) =>
|
||||
TimeProgress("", DateTime.now(), DateTime.now().add(duration));
|
||||
|
||||
TimeProgress copyWith(
|
||||
{String id, String name, DateTime startTime, DateTime endTime}) {
|
||||
return TimeProgress(
|
||||
name ?? this.name,
|
||||
startTime ?? this.startTime,
|
||||
endTime ?? this.endTime,
|
||||
id: id ?? this.id,
|
||||
);
|
||||
}
|
||||
{String? id, String? name, DateTime? startTime, DateTime? endTime}) =>
|
||||
TimeProgress(
|
||||
name ?? this.name,
|
||||
startTime ?? this.startTime,
|
||||
endTime ?? this.endTime,
|
||||
id: id ?? this.id,
|
||||
);
|
||||
|
||||
int daysBehind() {
|
||||
return DateTime.now().difference(startTime).inDays;
|
||||
}
|
||||
int daysBehind() => DateTime.now().difference(startTime).inDays;
|
||||
|
||||
int daysLeft() {
|
||||
return endTime.difference(DateTime.now()).inDays;
|
||||
}
|
||||
int daysLeft() => endTime.difference(DateTime.now()).inDays;
|
||||
|
||||
int allDays() {
|
||||
return endTime.difference(startTime).inDays;
|
||||
}
|
||||
int allDays() => endTime.difference(startTime).inDays;
|
||||
|
||||
double percentDone() {
|
||||
return this.daysBehind() / (this.allDays() / 100) / 100;
|
||||
double percent = daysBehind() / (allDays() / 100) / 100;
|
||||
if (percent < 0) percent = 0;
|
||||
if (percent > 1) percent = 1;
|
||||
return percent;
|
||||
}
|
||||
|
||||
bool hasStarted() =>
|
||||
DateTime.now().millisecondsSinceEpoch > startTime.millisecondsSinceEpoch;
|
||||
|
||||
int daysTillStart() {
|
||||
if (hasStarted()) throw TimeProgressHasStartedException();
|
||||
return startTime.difference(DateTime.now()).inDays;
|
||||
}
|
||||
|
||||
bool hasEnded() =>
|
||||
DateTime.now().millisecondsSinceEpoch > endTime.millisecondsSinceEpoch;
|
||||
|
||||
int daysSinceEnd() {
|
||||
if (!hasEnded()) throw TimeProgressHasNotEndedException();
|
||||
return DateTime.now().difference(endTime).inDays;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -63,20 +75,31 @@ class TimeProgress {
|
||||
endTime == other.endTime;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "TimeProgress{id: $id, name: $name, startTime: $startTime, endTime: $endTime}";
|
||||
}
|
||||
String toString() =>
|
||||
"TimeProgress{id: $id, name: $name, startTime: $startTime, endTime: $endTime}";
|
||||
|
||||
TimeProgressEntity toEntity() {
|
||||
if (!TimeProgress.isNameValid(name)) {
|
||||
throw TimeProgressInvalidNameException(name);
|
||||
}
|
||||
if (!TimeProgress.areTimesValid(startTime, endTime)) {
|
||||
throw TimeProgressStartTimeIsNotBeforeEndTimeException(
|
||||
startTime, endTime);
|
||||
}
|
||||
return TimeProgressEntity(id, name, startTime, endTime);
|
||||
}
|
||||
|
||||
static TimeProgress fromEntity(TimeProgressEntity entity) {
|
||||
return TimeProgress(
|
||||
entity.name,
|
||||
entity.startTime,
|
||||
entity.endTime,
|
||||
id: entity.id ?? Uuid().generateV4(),
|
||||
);
|
||||
}
|
||||
static TimeProgress fromEntity(TimeProgressEntity entity) =>
|
||||
TimeProgress(entity.name, entity.startTime, entity.endTime,
|
||||
id: entity.id);
|
||||
|
||||
static bool isValid(TimeProgress tp) =>
|
||||
TimeProgress.isNameValid(tp.name) &&
|
||||
TimeProgress.areTimesValid(tp.startTime, tp.endTime);
|
||||
|
||||
static bool isNameValid(String name) =>
|
||||
name != "" && name.length > 2 && name.length < 21;
|
||||
|
||||
static bool areTimesValid(DateTime startTime, DateTime endTime) =>
|
||||
startTime.isBefore(endTime);
|
||||
}
|
||||
|
60
lib/persistence/app_settings.dart
Normal file
@ -0,0 +1,60 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:time_progress_tracker/models/app_settings.dart';
|
||||
|
||||
class AppSettingsRepository {
|
||||
static const String _key = "app_settings";
|
||||
final SharedPreferences prefs;
|
||||
final JsonCodec codec;
|
||||
|
||||
AppSettingsRepository(this.prefs, {this.codec = json});
|
||||
|
||||
Future<AppSettingsEntity> loadAppSettings() {
|
||||
final String? jsonString = prefs.getString(_key);
|
||||
if (jsonString == null) {
|
||||
return Future<AppSettingsEntity>.value(AppSettingsEntity.defaults());
|
||||
}
|
||||
return Future<AppSettingsEntity>.value(
|
||||
AppSettingsEntity.fromJson(codec.decode(jsonString)));
|
||||
}
|
||||
|
||||
Future<bool> saveAppSettings(AppSettingsEntity appSettings) =>
|
||||
prefs.setString(_key, codec.encode(appSettings));
|
||||
}
|
||||
|
||||
class AppSettingsEntity {
|
||||
static const String _doneKey = "doneColorValue",
|
||||
_leftKey = "leftColorValue",
|
||||
_durationDaysKey = "durationDays";
|
||||
final int doneColorValue, leftColorValue, durationDays;
|
||||
|
||||
AppSettingsEntity(
|
||||
this.doneColorValue, this.leftColorValue, this.durationDays);
|
||||
|
||||
factory AppSettingsEntity.defaults() => AppSettings.defaults().toEntity();
|
||||
|
||||
@override
|
||||
int get hashCode => doneColorValue.hashCode ^ leftColorValue.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AppSettingsEntity &&
|
||||
runtimeType == other.runtimeType &&
|
||||
doneColorValue == other.doneColorValue &&
|
||||
leftColorValue == other.leftColorValue;
|
||||
|
||||
Map<String, Object> toJson() => {
|
||||
_doneKey: doneColorValue,
|
||||
_leftKey: leftColorValue,
|
||||
_durationDaysKey: durationDays,
|
||||
};
|
||||
|
||||
static AppSettingsEntity fromJson(Map<String, Object> json) =>
|
||||
AppSettingsEntity(
|
||||
json[_doneKey] as int,
|
||||
json[_leftKey] as int,
|
||||
json[_durationDaysKey] as int,
|
||||
);
|
||||
}
|
@ -29,7 +29,7 @@ class TimeProgressEntity {
|
||||
};
|
||||
}
|
||||
|
||||
static TimeProgressEntity fromJson(Map<String, Object> json) {
|
||||
static TimeProgressEntity fromJson(dynamic json) {
|
||||
final String id = json["id"] as String;
|
||||
final String name = json["name"] as String;
|
||||
final DateTime startTime =
|
||||
|
@ -2,8 +2,6 @@ import 'dart:convert';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:time_progress_tracker/persistence/time_progress_entity.dart';
|
||||
|
||||
import 'dart:developer' as developer;
|
||||
|
||||
class TimeProgressRepository {
|
||||
static const String _key = "time_progress_repo";
|
||||
final SharedPreferences prefs;
|
||||
@ -12,13 +10,12 @@ class TimeProgressRepository {
|
||||
TimeProgressRepository(this.prefs, {this.codec = json});
|
||||
|
||||
Future<List<TimeProgressEntity>> loadTimeProgressList() {
|
||||
final String jsonString = this.prefs.getString(_key);
|
||||
final String? jsonString = prefs.getString(_key);
|
||||
if (jsonString == null) {
|
||||
return Future<List<TimeProgressEntity>>.value([]);
|
||||
}
|
||||
return Future<List<TimeProgressEntity>>.value(codec
|
||||
.decode(jsonString)["timers"]
|
||||
.cast<Map<String, Object>>()
|
||||
.map<TimeProgressEntity>(TimeProgressEntity.fromJson)
|
||||
.toList(growable: false));
|
||||
}
|
||||
@ -26,6 +23,6 @@ class TimeProgressRepository {
|
||||
Future<bool> saveTimeProgressList(List<TimeProgressEntity> timeProgressList) {
|
||||
final String jsonString = codec.encode(
|
||||
{"timers": timeProgressList.map((timer) => timer.toJson()).toList()});
|
||||
return this.prefs.setString(_key, jsonString);
|
||||
return prefs.setString(_key, jsonString);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,35 @@
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
import 'package:time_progress_tracker/models/app_settings.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/reducers/has_loaded_reducer.dart';
|
||||
import 'package:time_progress_tracker/reducers/time_progress_list_reducer.dart';
|
||||
|
||||
AppState appStateReducer(AppState state, dynamic action) {
|
||||
return AppState(
|
||||
hasLoaded: hasLoadedReducer(state.hasLoaded, action),
|
||||
hasSettingsLoaded:
|
||||
hasSettingsLoadedReducer(state.hasSettingsLoaded, action),
|
||||
hasProgressesLoaded:
|
||||
hasProgressesLoadedReducer(state.hasProgressesLoaded, action),
|
||||
timeProgressList: timeProgressListReducer(state.timeProgressList, action),
|
||||
appSettings: appSettingsReducers(state.appSettings, action),
|
||||
);
|
||||
}
|
||||
|
||||
final appSettingsReducers = combineReducers<AppSettings>([
|
||||
TypedReducer<AppSettings, AppSettingsLoadedActions>(_loadAppSettings).call,
|
||||
TypedReducer<AppSettings, UpdateAppSettingsActions>(_updateAppSettings).call,
|
||||
TypedReducer<AppSettings, AppSettingsNotLoadedAction>(_setDefaultSettings).call
|
||||
]);
|
||||
|
||||
AppSettings _loadAppSettings(
|
||||
AppSettings appSettings, AppSettingsLoadedActions nS) =>
|
||||
nS.appSettings;
|
||||
|
||||
AppSettings _setDefaultSettings(
|
||||
AppSettings appSettings, AppSettingsNotLoadedAction action) =>
|
||||
AppSettings.defaults();
|
||||
|
||||
AppSettings _updateAppSettings(
|
||||
AppSettings appSettings, UpdateAppSettingsActions nS) =>
|
||||
nS.appSettings;
|
||||
|
@ -1,15 +1,28 @@
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
|
||||
final hasLoadedReducer = combineReducers<bool>([
|
||||
TypedReducer<bool, TimeProgressListLoadedAction>(_setLoaded),
|
||||
TypedReducer<bool, TimeProgressListNotLoadedAction>(_setUnloaded)
|
||||
final hasProgressesLoadedReducer = combineReducers<bool>([
|
||||
TypedReducer<bool, TimeProgressListLoadedAction>(_setProgressesLoaded).call,
|
||||
TypedReducer<bool, TimeProgressListNotLoadedAction>(_setProgressesUnloaded).call
|
||||
]);
|
||||
|
||||
bool _setLoaded(bool hasLoaded, TimeProgressListLoadedAction action) {
|
||||
bool _setProgressesLoaded(bool hasLoaded, TimeProgressListLoadedAction action) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _setUnloaded(bool hasLoaded, TimeProgressListNotLoadedAction action) {
|
||||
bool _setProgressesUnloaded(bool hasLoaded, TimeProgressListNotLoadedAction action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final hasSettingsLoadedReducer = combineReducers<bool>([
|
||||
TypedReducer<bool, AppSettingsLoadedActions>(_setSettingsLoaded).call,
|
||||
TypedReducer<bool, AppSettingsNotLoadedAction>(_setSettingsUnloaded).call
|
||||
]);
|
||||
|
||||
bool _setSettingsLoaded(bool hasLoaded, AppSettingsLoadedActions action) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _setSettingsUnloaded(bool hasLoaded, AppSettingsNotLoadedAction action) {
|
||||
return false;
|
||||
}
|
@ -4,13 +4,13 @@ import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
|
||||
final timeProgressListReducer = combineReducers<List<TimeProgress>>([
|
||||
TypedReducer<List<TimeProgress>, TimeProgressListLoadedAction>(
|
||||
_setLoadedTimeProgressList),
|
||||
_setLoadedTimeProgressList).call,
|
||||
TypedReducer<List<TimeProgress>, TimeProgressListNotLoadedAction>(
|
||||
_setEmptyTimeProgressList),
|
||||
TypedReducer<List<TimeProgress>, AddTimeProgressAction>(_addTimeProgress),
|
||||
_setEmptyTimeProgressList).call,
|
||||
TypedReducer<List<TimeProgress>, AddTimeProgressAction>(_addTimeProgress).call,
|
||||
TypedReducer<List<TimeProgress>, UpdateTimeProgressAction>(
|
||||
_updateTimeProgress),
|
||||
TypedReducer<List<TimeProgress>, DeleteTimeProgressAction>(_deleteTimeProgress),
|
||||
_updateTimeProgress).call,
|
||||
TypedReducer<List<TimeProgress>, DeleteTimeProgressAction>(_deleteTimeProgress).call,
|
||||
]);
|
||||
|
||||
List<TimeProgress> _setLoadedTimeProgressList(
|
||||
|
52
lib/screens/home_screen.dart
Normal file
@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/widgets/buttons/create_progress_button.dart';
|
||||
import 'package:time_progress_tracker/widgets/home/home_bottom_navbar.dart';
|
||||
import 'package:time_progress_tracker/widgets/home/tabs/home_active_progresses_tab.dart';
|
||||
import 'package:time_progress_tracker/widgets/home/tabs/home_inactive_progresses_tab.dart';
|
||||
import 'package:time_progress_tracker/widgets/home/tabs/home_settings_tab.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
static const routeName = "/home";
|
||||
static const title = "Time Progress Tracker";
|
||||
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _HomeScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
int _currentIndex = 0;
|
||||
final List<Widget> _children = [
|
||||
const HomeActiveProgressesTab(),
|
||||
const HomeInactiveProgressesTab(),
|
||||
const HomeSettingsTab(),
|
||||
];
|
||||
|
||||
void onBottomTabTapped(int index) {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData appTheme = Theme.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(HomeScreen.title),
|
||||
backgroundColor: appTheme.colorScheme.primary,
|
||||
),
|
||||
body: _children[_currentIndex],
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||
floatingActionButton: _currentIndex != 2 ? const CreateProgressButton() : null,
|
||||
bottomNavigationBar: HomeBottomNavBar(
|
||||
currentIndex: _currentIndex,
|
||||
onTap: onBottomTabTapped,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,20 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
import 'package:time_progress_tracker/models/app_exceptions.dart';
|
||||
import 'package:time_progress_tracker/models/app_settings.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_dashboard_screen.dart';
|
||||
import 'package:time_progress_tracker/widgets/app_drawer_widget.dart';
|
||||
import 'package:time_progress_tracker/selectors/time_progress_selectors.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_editor_widget.dart';
|
||||
|
||||
class ProgressCreationScreen extends StatefulWidget {
|
||||
static const routeName = "/progress-creation";
|
||||
static const routeName = "/create-progress";
|
||||
static const title = "Create Time Progress";
|
||||
|
||||
final String appVersion;
|
||||
|
||||
ProgressCreationScreen({Key key, @required this.appVersion})
|
||||
: super(key: key);
|
||||
const ProgressCreationScreen({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@ -23,139 +21,77 @@ class ProgressCreationScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProgressCreationScreenState extends State<ProgressCreationScreen> {
|
||||
final TextEditingController _nameController = TextEditingController();
|
||||
DateTime pickedStartTime = DateTime.now();
|
||||
DateTime pickedEndTime = DateTime(
|
||||
DateTime.now().year + 1, DateTime.now().month, DateTime.now().day);
|
||||
TimeProgress? timeProgressToCreate;
|
||||
bool _isProgressValid = false;
|
||||
|
||||
bool _validName = true;
|
||||
|
||||
Future<DateTime> _selectDate(
|
||||
BuildContext context, DateTime initialDate) async {
|
||||
return await showDatePicker(
|
||||
context: context,
|
||||
initialDate: initialDate,
|
||||
firstDate: DateTime(DateTime.now().year - 5),
|
||||
lastDate: DateTime(DateTime.now().year + 5));
|
||||
}
|
||||
|
||||
void _createTimeProgress(BuildContext context) {
|
||||
try {
|
||||
TimeProgress tpToCreate =
|
||||
TimeProgress(_nameController.text, pickedStartTime, pickedEndTime);
|
||||
StoreProvider.of<AppState>(context)
|
||||
.dispatch(AddTimeProgressAction(tpToCreate));
|
||||
Navigator.pushNamed(context, ProgressDashboardScreen.routeName);
|
||||
} on TimeProgressInvalidNameException catch (e) {
|
||||
void initTimeProgress(TimeProgress timeProgress) {
|
||||
if (timeProgressToCreate == null) {
|
||||
setState(() {
|
||||
_validName = false;
|
||||
timeProgressToCreate = timeProgress;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
super.dispose();
|
||||
void onTimeProgressChanged(
|
||||
TimeProgress newTimeProgress, bool isNewProgressValid) {
|
||||
setState(() {
|
||||
timeProgressToCreate = newTimeProgress;
|
||||
_isProgressValid = isNewProgressValid;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData appTheme = Theme.of(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Create Time Progress"),
|
||||
),
|
||||
drawer: AppDrawer(
|
||||
appVersion: widget.appVersion,
|
||||
title: const Text(ProgressCreationScreen.title),
|
||||
backgroundColor: appTheme.colorScheme.primary,
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: TextField(
|
||||
controller: _nameController,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: "Progress Name",
|
||||
errorText: _validName
|
||||
? null
|
||||
: "The Name of the Time Progress has to be set.",
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text("${_nameController.text}"),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: FlatButton(
|
||||
color: Colors.blue,
|
||||
child: Text(
|
||||
"Start Date: ${pickedStartTime.toLocal().toString().split(" ")[0]}"),
|
||||
onPressed: () async {
|
||||
DateTime dt =
|
||||
await _selectDate(context, pickedStartTime);
|
||||
if (dt != null) {
|
||||
setState(() {
|
||||
pickedStartTime = dt;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: FlatButton(
|
||||
color: Colors.blue,
|
||||
child: Text(
|
||||
"End Date: ${pickedEndTime.toLocal().toString().split(" ")[0]}"),
|
||||
onPressed: () async {
|
||||
DateTime dt = await _selectDate(context, pickedEndTime);
|
||||
if (dt != null) {
|
||||
setState(() {
|
||||
pickedEndTime = dt;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(
|
||||
flex: 5,
|
||||
)
|
||||
],
|
||||
),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: StoreConnector<AppState, _ViewModel>(
|
||||
onInit: loadSettingsIfUnloaded,
|
||||
converter: (store) => _ViewModel.create(store),
|
||||
builder: (context, _ViewModel viewModel) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
initTimeProgress(viewModel.defaultDurationProgress);
|
||||
});
|
||||
return ProgressEditorWidget(
|
||||
timeProgress:
|
||||
timeProgressToCreate ?? viewModel.defaultDurationProgress,
|
||||
onTimeProgressChanged: onTimeProgressChanged,
|
||||
);
|
||||
}),
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||
floatingActionButton: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag: "createTimeProgressBTN",
|
||||
child: Icon(Icons.save),
|
||||
onPressed: () {
|
||||
_createTimeProgress(context);
|
||||
},
|
||||
child: StoreConnector<AppState, _ViewModel>(
|
||||
onInit: loadSettingsIfUnloaded,
|
||||
converter: (store) => _ViewModel.create(store),
|
||||
builder: (context, _ViewModel vm) => FloatingActionButton(
|
||||
heroTag: "createTimeProgressBTN",
|
||||
onPressed: _isProgressValid
|
||||
? () {
|
||||
vm.onAddTimeProgress(
|
||||
timeProgressToCreate ?? vm.defaultDurationProgress);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
: null,
|
||||
child: const Icon(Icons.save),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag: "cancelTimeProgressCreationBTN",
|
||||
child: Icon(Icons.cancel),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, ProgressDashboardScreen.routeName);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Icon(Icons.cancel),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -163,3 +99,27 @@ class _ProgressCreationScreenState extends State<ProgressCreationScreen> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ViewModel {
|
||||
final TimeProgress defaultDurationProgress;
|
||||
final void Function(TimeProgress) onAddTimeProgress;
|
||||
|
||||
_ViewModel({
|
||||
required this.defaultDurationProgress,
|
||||
required this.onAddTimeProgress,
|
||||
});
|
||||
|
||||
factory _ViewModel.create(Store<AppState> store) {
|
||||
AppSettings settings = appSettingsSelector(store.state);
|
||||
|
||||
onAddTimeProgress(TimeProgress tp) {
|
||||
if (TimeProgress.isValid(tp)) store.dispatch(AddTimeProgressAction(tp));
|
||||
}
|
||||
|
||||
return _ViewModel(
|
||||
defaultDurationProgress:
|
||||
TimeProgress.defaultFromDuration(settings.duration),
|
||||
onAddTimeProgress: onAddTimeProgress,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,181 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:percent_indicator/linear_percent_indicator.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_creation_screen.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_detail_screen.dart';
|
||||
import 'package:time_progress_tracker/selectors/time_progress_selectors.dart';
|
||||
import 'package:time_progress_tracker/widgets/app_drawer_widget.dart';
|
||||
|
||||
class ProgressDashboardScreen extends StatelessWidget {
|
||||
static const routeName = "/progress-dashboard";
|
||||
static const title = "Time Progress Dashboard";
|
||||
|
||||
final String appVersion;
|
||||
|
||||
ProgressDashboardScreen({
|
||||
Key key,
|
||||
@required this.appVersion,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AppBar appBar = AppBar(
|
||||
title: Text(title),
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
appBar: appBar,
|
||||
drawer: AppDrawer(
|
||||
appVersion: appVersion,
|
||||
),
|
||||
body: StoreConnector(
|
||||
converter: _ViewModel.fromStore,
|
||||
onInit: loadTimeProgressListIfUnloaded,
|
||||
builder: (BuildContext context, _ViewModel vm) {
|
||||
if (!vm.hasLoaded) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> startedProgressesTileList = List<Widget>();
|
||||
if (vm.hasStartedProgresses) {
|
||||
for (TimeProgress tp in vm.startedTimeProgreses) {
|
||||
startedProgressesTileList.add(
|
||||
Card(
|
||||
child: ListTile(
|
||||
title: Text(tp.name),
|
||||
subtitle: LinearPercentIndicator(
|
||||
center: Text("${(tp.percentDone() * 100).floor()} %"),
|
||||
percent: tp.percentDone(),
|
||||
progressColor: Colors.green,
|
||||
backgroundColor: Colors.red,
|
||||
lineHeight: 20,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, ProgressDetailScreen.routeName,
|
||||
arguments: ProgressDetailScreenArguments(tp.id));
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
List<Widget> futureProgressesTileList = List<Widget>();
|
||||
if (vm.hasFutureProgresses) {
|
||||
for (TimeProgress tp in vm.futureTimeProgresses) {
|
||||
futureProgressesTileList.add(
|
||||
Card(
|
||||
child: ListTile(
|
||||
title: Text(tp.name),
|
||||
subtitle: Text(
|
||||
"Starts in ${tp.startTime.difference(DateTime.now()).inDays} Days."),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, ProgressDetailScreen.routeName,
|
||||
arguments: ProgressDetailScreenArguments(tp.id));
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
double dividerHeight = 1;
|
||||
double screenHeight = MediaQuery.of(context).size.height -
|
||||
appBar.preferredSize.height -
|
||||
24 -
|
||||
dividerHeight; //Divider
|
||||
|
||||
List<Widget> columnChildren = List<Widget>();
|
||||
int tpCount =
|
||||
vm.startedTimeProgreses.length + vm.futureTimeProgresses.length;
|
||||
if (vm.hasStartedProgresses) {
|
||||
columnChildren.add(Container(
|
||||
height: vm.hasFutureProgresses
|
||||
? (screenHeight / tpCount) * vm.startedTimeProgreses.length
|
||||
: screenHeight,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(8),
|
||||
children: startedProgressesTileList,
|
||||
),
|
||||
));
|
||||
}
|
||||
if (vm.hasStartedProgresses && vm.hasFutureProgresses) {
|
||||
columnChildren.add(Divider(
|
||||
height: dividerHeight,
|
||||
));
|
||||
}
|
||||
if (vm.hasFutureProgresses) {
|
||||
columnChildren.add(Container(
|
||||
height: vm.hasStartedProgresses
|
||||
? (screenHeight / tpCount) * vm.futureTimeProgresses.length
|
||||
: screenHeight,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.all(8),
|
||||
children: futureProgressesTileList,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
if (!vm.hasStartedProgresses && !vm.hasFutureProgresses) {
|
||||
columnChildren.add(Container(
|
||||
margin: EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: Text("You don't have any tracked Progress."),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: columnChildren,
|
||||
);
|
||||
},
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
|
||||
floatingActionButton: FloatingActionButton(
|
||||
heroTag: "createProgressBTN",
|
||||
child: Icon(Icons.add),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, ProgressCreationScreen.routeName);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ViewModel {
|
||||
final List<TimeProgress> startedTimeProgreses;
|
||||
final bool hasStartedProgresses;
|
||||
final List<TimeProgress> futureTimeProgresses;
|
||||
final bool hasFutureProgresses;
|
||||
final bool hasLoaded;
|
||||
|
||||
_ViewModel({
|
||||
@required this.startedTimeProgreses,
|
||||
@required this.hasStartedProgresses,
|
||||
@required this.futureTimeProgresses,
|
||||
@required this.hasFutureProgresses,
|
||||
@required this.hasLoaded,
|
||||
});
|
||||
|
||||
static _ViewModel fromStore(Store<AppState> store) {
|
||||
List<TimeProgress> startedTPList =
|
||||
startedTimeProgressesSelector(store.state);
|
||||
List<TimeProgress> furtureTPList =
|
||||
futureTimeProgressesSelector(store.state);
|
||||
return _ViewModel(
|
||||
startedTimeProgreses: startedTPList,
|
||||
hasStartedProgresses: startedTPList.length > 0,
|
||||
futureTimeProgresses: furtureTPList,
|
||||
hasFutureProgresses: furtureTPList.length > 0,
|
||||
hasLoaded: store.state.hasLoaded,
|
||||
);
|
||||
}
|
||||
}
|
@ -1,19 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
import 'package:time_progress_tracker/models/app_exceptions.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_dashboard_screen.dart';
|
||||
import 'package:time_progress_tracker/selectors/time_progress_selectors.dart';
|
||||
import 'package:time_progress_tracker/widgets/app_drawer_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/app_yes_no_dialog_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_detail_widgets/progress_detail_circular_percent_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_detail_widgets/progress_detail_edit_dates_row_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_detail_widgets/progress_detail_fab_editing_row_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_detail_widgets/progress_detail_fab_row_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_detail_widgets/progress_detail_linear_percent_widget.dart';
|
||||
import 'package:time_progress_tracker/screens/home_screen.dart';
|
||||
import 'package:time_progress_tracker/widgets/detail_screen_floating_action_buttons.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_editor_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_view_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/store_connectors/settings_store_connector.dart';
|
||||
import 'package:time_progress_tracker/widgets/store_connectors/time_progress_store_connector.dart';
|
||||
|
||||
class ProgressDetailScreenArguments {
|
||||
final String id;
|
||||
@ -22,14 +14,10 @@ class ProgressDetailScreenArguments {
|
||||
}
|
||||
|
||||
class ProgressDetailScreen extends StatefulWidget {
|
||||
static const routeName = "/progress-detail";
|
||||
static const routeName = "/progress";
|
||||
static const title = "Progress View";
|
||||
|
||||
final String appVersion;
|
||||
|
||||
ProgressDetailScreen({
|
||||
Key key,
|
||||
@required this.appVersion,
|
||||
}) : super(key: key);
|
||||
const ProgressDetailScreen({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@ -38,258 +26,111 @@ class ProgressDetailScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
|
||||
bool _isBeingEdited = false;
|
||||
final TextEditingController _nameController = TextEditingController();
|
||||
bool _editMode = false, _isEditedProgressValid = false;
|
||||
TimeProgress? _editedProgress, _originalProgress;
|
||||
|
||||
TimeProgress _editedProgress = TimeProgress.initialDefault();
|
||||
|
||||
bool _validName = true;
|
||||
|
||||
void _onStartDateChanged(DateTime picked) {
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
_editedProgress = _editedProgress.copyWith(startTime: picked);
|
||||
});
|
||||
void _initEditedProgress(TimeProgress tp) {
|
||||
if (_editedProgress == null) {
|
||||
_editedProgress = tp;
|
||||
_originalProgress = tp;
|
||||
}
|
||||
}
|
||||
|
||||
void _onEndDateChanged(DateTime picked) {
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
_editedProgress = _editedProgress.copyWith(endTime: picked);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _onSaveTimeProgress(Store<AppState> store, id) {
|
||||
store.dispatch(UpdateTimeProgressAction(id, _editedProgress));
|
||||
void _onEditedProgressChanged(
|
||||
TimeProgress newProgress, bool isNewProgressValid) {
|
||||
setState(() {
|
||||
_isBeingEdited = false;
|
||||
_editedProgress = newProgress;
|
||||
_isEditedProgressValid = isNewProgressValid;
|
||||
});
|
||||
}
|
||||
|
||||
void _showCancelEditTimeProgressDialog(AppState state, id) {
|
||||
TimeProgress originalTp = timeProgressByIdSelector(state, id);
|
||||
if (originalTp != _editedProgress) {
|
||||
String originalName = timeProgressByIdSelector(state, id).name;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AppYesNoDialog(
|
||||
titleText: "Cancel Editing of $originalName",
|
||||
contentText:
|
||||
"Are you sure that you want to discard the changes done to $originalName",
|
||||
onYesPressed: _onCancelEditTimeProgress,
|
||||
onNoPressed: _onCloseDialog,
|
||||
),
|
||||
);
|
||||
void _switchEditMode(bool newMode) {
|
||||
setState(() {
|
||||
_editMode = newMode;
|
||||
});
|
||||
}
|
||||
|
||||
void _cancelEditMode() {
|
||||
setState(() {
|
||||
_editMode = false;
|
||||
_editedProgress = _originalProgress;
|
||||
});
|
||||
}
|
||||
|
||||
List<Widget> _renderColumnChildren(
|
||||
SettingsViewModel settingsVm, TimeProgressViewModel tpVm) {
|
||||
List<Widget> columnChildren = [];
|
||||
if (!_editMode) {
|
||||
columnChildren.add(Expanded(
|
||||
child: ProgressViewWidget(
|
||||
timeProgress: _editMode ? _editedProgress ?? tpVm.tp : tpVm.tp,
|
||||
doneColor: settingsVm.appSettings.doneColor,
|
||||
leftColor: settingsVm.appSettings.leftColor,
|
||||
)));
|
||||
} else {
|
||||
setState(() {
|
||||
_isBeingEdited = false;
|
||||
});
|
||||
columnChildren.add(Expanded(
|
||||
child: ProgressEditorWidget(
|
||||
timeProgress: _editedProgress ?? tpVm.tp,
|
||||
onTimeProgressChanged: _onEditedProgressChanged,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
void _onCancelEditTimeProgress() {
|
||||
setState(() {
|
||||
_isBeingEdited = false;
|
||||
});
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
void _onEditTimeProgress(Store<AppState> store, id) {
|
||||
setState(() {
|
||||
_isBeingEdited = true;
|
||||
_editedProgress = timeProgressByIdSelector(store.state, id);
|
||||
_nameController.text = _editedProgress.name;
|
||||
});
|
||||
}
|
||||
|
||||
void _showDeleteTimeProgressDialog(Store<AppState> store, id) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AppYesNoDialog(
|
||||
titleText: "Delete ${timeProgressByIdSelector(store.state, id).name}",
|
||||
contentText: "Are you sure you want to delete this time progress?",
|
||||
onYesPressed: () => _onDeleteTimeProgress(store, id),
|
||||
onNoPressed: _onCloseDialog,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _onDeleteTimeProgress(Store<AppState> store, String id) {
|
||||
store.dispatch(DeleteTimeProgressAction(id));
|
||||
Navigator.popAndPushNamed(context, ProgressDashboardScreen.routeName);
|
||||
}
|
||||
|
||||
void _onCloseDialog() {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_nameController.addListener(() {
|
||||
try {
|
||||
TimeProgress editedProgress =
|
||||
_editedProgress.copyWith(name: _nameController.text);
|
||||
setState(() {
|
||||
_editedProgress = editedProgress;
|
||||
_validName = true;
|
||||
});
|
||||
} on TimeProgressInvalidNameException catch (e) {
|
||||
setState(() {
|
||||
_validName = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
return columnChildren;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ProgressDetailScreenArguments args =
|
||||
ModalRoute.of(context).settings.arguments;
|
||||
final Store<AppState> store = StoreProvider.of<AppState>(context);
|
||||
final ThemeData appTheme = Theme.of(context);
|
||||
final ProgressDetailScreenArguments args = ModalRoute.of(context)
|
||||
?.settings
|
||||
.arguments as ProgressDetailScreenArguments;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Progress"),
|
||||
title: const Text(ProgressDetailScreen.title),
|
||||
backgroundColor: appTheme.colorScheme.primary,
|
||||
),
|
||||
drawer: AppDrawer(
|
||||
appVersion: widget.appVersion,
|
||||
),
|
||||
body: Container(
|
||||
margin: EdgeInsets.all(8),
|
||||
child: StoreConnector(
|
||||
converter: (Store<AppState> store) =>
|
||||
_ViewModel.fromStoreAndArg(store, args),
|
||||
onInit: loadTimeProgressListIfUnloaded,
|
||||
builder: (BuildContext context, _ViewModel vm) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: _isBeingEdited
|
||||
? TextField(
|
||||
controller: _nameController,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: "Progress Name",
|
||||
errorText: _validName
|
||||
? null
|
||||
: "The Name of the Time Progress has to be set.",
|
||||
),
|
||||
)
|
||||
: vm.hasProgressStarted
|
||||
? FittedBox(
|
||||
fit: BoxFit.fitWidth,
|
||||
child: Text(
|
||||
vm.timeProgress.name,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Center(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.fitWidth,
|
||||
child: Text(
|
||||
vm.timeProgress.name,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: SettingsStoreConnector(
|
||||
loadedBuilder: (context, settingsVm) {
|
||||
return TimeProgressStoreConnector(
|
||||
timeProgressId: args.id,
|
||||
loadedBuilder: (context, tpVm) {
|
||||
_initEditedProgress(tpVm.tp);
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
children: _renderColumnChildren(settingsVm, tpVm),
|
||||
),
|
||||
vm.hasProgressStarted
|
||||
? Expanded(
|
||||
flex: 2,
|
||||
child: ProgressDetailCircularPercent(
|
||||
percentDone: _isBeingEdited
|
||||
? _editedProgress.percentDone()
|
||||
: vm.timeProgress.percentDone(),
|
||||
),
|
||||
)
|
||||
: Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
"Starts in ${vm.timeProgress.startTime.difference(DateTime.now()).inDays} Days."),
|
||||
),
|
||||
vm.hasProgressStarted
|
||||
? Expanded(
|
||||
flex: 1,
|
||||
child: ProgressDetailLinearPercent(
|
||||
timeProgress: _isBeingEdited
|
||||
? _editedProgress
|
||||
: vm.timeProgress,
|
||||
),
|
||||
)
|
||||
: Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
"${_isBeingEdited ? _editedProgress.allDays() : vm.timeProgress.allDays()} Days"),
|
||||
),
|
||||
this._isBeingEdited
|
||||
? Expanded(
|
||||
flex: 1,
|
||||
child: ProgressDetailEditDatesRow(
|
||||
startTime: _editedProgress.startTime,
|
||||
endTime: _editedProgress.endTime,
|
||||
onStartTimeChanged: _onStartDateChanged,
|
||||
onEndTimeChanged: _onEndDateChanged,
|
||||
),
|
||||
)
|
||||
: Spacer(flex: 1),
|
||||
Spacer(flex: 1)
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||
floatingActionButton: _isBeingEdited
|
||||
? ProgressDetailFabEditingRow(
|
||||
onSave: () =>
|
||||
_validName ? _onSaveTimeProgress(store, args.id) : null,
|
||||
onCancelEdit: () =>
|
||||
_showCancelEditTimeProgressDialog(store.state, args.id),
|
||||
)
|
||||
: ProgressDetailFabRow(
|
||||
onEdit: () => _onEditTimeProgress(store, args.id),
|
||||
onDelete: () => _showDeleteTimeProgressDialog(store, args.id),
|
||||
),
|
||||
floatingActionButton: TimeProgressStoreConnector(
|
||||
timeProgressId: args.id,
|
||||
loadedBuilder: (context, tpVm) {
|
||||
void saveEditedProgress() {
|
||||
tpVm.updateTimeProgress(_editedProgress ?? tpVm.tp);
|
||||
_switchEditMode(false);
|
||||
}
|
||||
|
||||
void deleteTimeProgress() {
|
||||
tpVm.deleteTimeProgress();
|
||||
Navigator.popUntil(
|
||||
context, ModalRoute.withName(HomeScreen.routeName));
|
||||
}
|
||||
|
||||
return DetailScreenFloatingActionButtons(
|
||||
editMode: _editMode,
|
||||
originalProgress: tpVm.tp,
|
||||
editedProgress: _editedProgress ?? tpVm.tp,
|
||||
isEditedProgressValid: _isEditedProgressValid,
|
||||
onEditProgress: () => _switchEditMode(true),
|
||||
onSaveEditedProgress: saveEditedProgress,
|
||||
onCancelEditProgress: _cancelEditMode,
|
||||
onDeleteProgress: deleteTimeProgress);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class _ViewModel {
|
||||
final TimeProgress timeProgress;
|
||||
final bool hasProgressStarted;
|
||||
|
||||
_ViewModel({
|
||||
@required this.timeProgress,
|
||||
@required this.hasProgressStarted,
|
||||
});
|
||||
|
||||
static _ViewModel fromStoreAndArg(
|
||||
Store<AppState> store, ProgressDetailScreenArguments args) {
|
||||
TimeProgress tp = timeProgressByIdSelector(store.state, args.id);
|
||||
return _ViewModel(
|
||||
timeProgress: tp,
|
||||
hasProgressStarted: DateTime.now().millisecondsSinceEpoch >
|
||||
tp.startTime.millisecondsSinceEpoch);
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,35 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:time_progress_tracker/models/app_settings.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
|
||||
List<TimeProgress> timeProgressListSelector(AppState state) =>
|
||||
state.timeProgressList;
|
||||
|
||||
List<TimeProgress> startedTimeProgressesSelector(AppState state) =>
|
||||
state.timeProgressList
|
||||
.where((timeProgress) =>
|
||||
DateTime.now().millisecondsSinceEpoch >=
|
||||
timeProgress.startTime.millisecondsSinceEpoch)
|
||||
.toList();
|
||||
List<TimeProgress> activeTimeProgressesSelector(AppState state) {
|
||||
return state.timeProgressList
|
||||
.where((timeProgress) =>
|
||||
timeProgress.hasStarted() && !timeProgress.hasEnded())
|
||||
.toList();
|
||||
}
|
||||
|
||||
List<TimeProgress> inactiveTimeProgressesSelector(AppState state) {
|
||||
return state.timeProgressList
|
||||
.where((timeProgress) =>
|
||||
!timeProgress.hasStarted() || timeProgress.hasEnded())
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Deprecated("use active TimeProgresses Selector instead.")
|
||||
List<TimeProgress> currentTimeProgressSelector(AppState state) {
|
||||
int currentTime = DateTime.now().millisecondsSinceEpoch;
|
||||
return state.timeProgressList
|
||||
.where((tp) =>
|
||||
currentTime >= tp.startTime.millisecondsSinceEpoch &&
|
||||
tp.endTime.millisecondsSinceEpoch >= currentTime)
|
||||
.toList();
|
||||
}
|
||||
|
||||
List<TimeProgress> futureTimeProgressesSelector(AppState state) =>
|
||||
state.timeProgressList
|
||||
@ -18,8 +38,22 @@ List<TimeProgress> futureTimeProgressesSelector(AppState state) =>
|
||||
timeProgress.startTime.millisecondsSinceEpoch)
|
||||
.toList();
|
||||
|
||||
TimeProgress timeProgressByIdSelector(AppState state, String id) {
|
||||
if (state.timeProgressList.length < 1) return null;
|
||||
return state.timeProgressList
|
||||
.firstWhere((timeProgress) => timeProgress.id == id);
|
||||
List<TimeProgress> pastTimeProgressesSelector(AppState state) =>
|
||||
state.timeProgressList
|
||||
.where((tp) =>
|
||||
tp.endTime.millisecondsSinceEpoch <
|
||||
DateTime.now().millisecondsSinceEpoch)
|
||||
.toList();
|
||||
|
||||
TimeProgress? timeProgressByIdSelector(AppState state, String id) {
|
||||
if (state.timeProgressList.isEmpty) return null;
|
||||
return state.timeProgressList.firstWhere(
|
||||
(timeProgress) => timeProgress.id == id,
|
||||
orElse: () => TimeProgress.initialDefault());
|
||||
}
|
||||
|
||||
AppSettings appSettingsSelector(AppState state) {
|
||||
return state.appSettings;
|
||||
}
|
||||
|
||||
Color doneColorSelector(AppState state) => state.appSettings.doneColor;
|
||||
|
@ -1,127 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:percent_indicator/circular_percent_indicator.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
import 'package:time_progress_tracker/app.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_dashboard_screen.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_detail_screen.dart';
|
||||
import 'package:time_progress_tracker/selectors/time_progress_selectors.dart';
|
||||
|
||||
class AppDrawer extends StatelessWidget {
|
||||
final String appVersion;
|
||||
|
||||
AppDrawer({
|
||||
Key key,
|
||||
@required this.appVersion,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Drawer(
|
||||
child: StoreConnector(
|
||||
converter: _ViewModel.fromStore,
|
||||
onInit: loadTimeProgressListIfUnloaded,
|
||||
builder: (context, _ViewModel vm) {
|
||||
if (!vm.hasLoaded) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
List<Widget> drawerTileList = List<Widget>();
|
||||
drawerTileList.add(DrawerHeader(
|
||||
child: Text(TimeProgressTrackerApp.name),
|
||||
decoration: BoxDecoration(color: Colors.blue),
|
||||
margin: EdgeInsets.zero,
|
||||
));
|
||||
drawerTileList.add(Container(
|
||||
color: Colors.lightBlue,
|
||||
margin: EdgeInsets.only(bottom: 8),
|
||||
child: ListTile(
|
||||
title: Text(ProgressDashboardScreen.title),
|
||||
trailing: Icon(Icons.dashboard),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, ProgressDashboardScreen.routeName);
|
||||
},
|
||||
),
|
||||
));
|
||||
if (vm.startedTimeProgresses.length > 0) {
|
||||
for (TimeProgress tp in vm.startedTimeProgresses) {
|
||||
drawerTileList.add(ListTile(
|
||||
title: Text(tp.name),
|
||||
trailing: CircularPercentIndicator(
|
||||
percent: tp.percentDone(),
|
||||
radius: 40,
|
||||
progressColor: Colors.green,
|
||||
backgroundColor: Colors.red,
|
||||
center: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child:
|
||||
Text((tp.percentDone() * 100).floor().toString() + "%"),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
ProgressDetailScreen.routeName,
|
||||
arguments: ProgressDetailScreenArguments(tp.id),
|
||||
);
|
||||
},
|
||||
));
|
||||
if (vm.startedTimeProgresses.last != tp) {
|
||||
drawerTileList.add(Divider(
|
||||
color: Colors.black12,
|
||||
));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
drawerTileList.add(ListTile(
|
||||
title: Text("You don't have any tracked time progress."),
|
||||
));
|
||||
}
|
||||
drawerTileList.add(Divider(
|
||||
color: Colors.black38,
|
||||
));
|
||||
drawerTileList.add(Container(
|
||||
margin: EdgeInsets.only(bottom: 8),
|
||||
child: ListTile(
|
||||
title: Text("About"),
|
||||
onTap: () {
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
applicationName: TimeProgressTrackerApp.name,
|
||||
applicationVersion: " Version $appVersion",
|
||||
applicationLegalese: '\u00a9Andreas Fahrecker 2020');
|
||||
},
|
||||
),
|
||||
));
|
||||
return ListView(
|
||||
children: drawerTileList,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ViewModel {
|
||||
final List<TimeProgress> startedTimeProgresses;
|
||||
final bool hasLoaded;
|
||||
|
||||
_ViewModel({
|
||||
@required this.startedTimeProgresses,
|
||||
@required this.hasLoaded,
|
||||
});
|
||||
|
||||
static _ViewModel fromStore(Store<AppState> store) {
|
||||
return _ViewModel(
|
||||
startedTimeProgresses: startedTimeProgressesSelector(store.state),
|
||||
hasLoaded: store.state.hasLoaded,
|
||||
);
|
||||
}
|
||||
}
|
@ -4,15 +4,13 @@ class AppYesNoDialog extends StatelessWidget {
|
||||
final String titleText;
|
||||
final String contentText;
|
||||
final void Function() onYesPressed;
|
||||
final void Function() onNoPressed;
|
||||
|
||||
AppYesNoDialog({
|
||||
Key key,
|
||||
@required this.titleText,
|
||||
@required this.contentText,
|
||||
@required this.onYesPressed,
|
||||
@required this.onNoPressed,
|
||||
}) : super(key: key);
|
||||
const AppYesNoDialog({
|
||||
super.key,
|
||||
required this.titleText,
|
||||
required this.contentText,
|
||||
required this.onYesPressed,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -20,13 +18,15 @@ class AppYesNoDialog extends StatelessWidget {
|
||||
title: Text(titleText),
|
||||
content: Text(contentText),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Yes"),
|
||||
TextButton(
|
||||
onPressed: onYesPressed,
|
||||
child: const Text("Yes"),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("No"),
|
||||
onPressed: onNoPressed,
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text("No"),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
47
lib/widgets/buttons/color_picker_btn.dart
Normal file
@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||
import 'package:time_progress_tracker/helper_functions.dart';
|
||||
|
||||
class ColorPickerButton extends StatelessWidget {
|
||||
final String title, dialogTitle;
|
||||
final Color selectedColor;
|
||||
final void Function(Color) onColorPicked;
|
||||
|
||||
const ColorPickerButton({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.dialogTitle,
|
||||
required this.selectedColor,
|
||||
required this.onColorPicked,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ThemeData appTheme = Theme.of(context);
|
||||
return TextButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(dialogTitle),
|
||||
content: SingleChildScrollView(
|
||||
child: BlockPicker(
|
||||
pickerColor: selectedColor,
|
||||
onColorChanged: onColorPicked,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: useBrightBackground(selectedColor)
|
||||
? appTheme.primaryTextTheme.labelLarge?.color
|
||||
: appTheme.textTheme.labelLarge?.color,
|
||||
backgroundColor: selectedColor,
|
||||
),
|
||||
child: Text(title),
|
||||
);
|
||||
}
|
||||
}
|
20
lib/widgets/buttons/create_progress_button.dart
Normal file
@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/screens/progress_creation_screen.dart';
|
||||
|
||||
class CreateProgressButton extends StatelessWidget {
|
||||
final String _heroTag = "createProgressBTN";
|
||||
|
||||
const CreateProgressButton({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
void onButtonPressed() =>
|
||||
Navigator.pushNamed(context, ProgressCreationScreen.routeName);
|
||||
|
||||
return FloatingActionButton(
|
||||
heroTag: _heroTag,
|
||||
onPressed: onButtonPressed,
|
||||
child: const Icon(Icons.add),
|
||||
);
|
||||
}
|
||||
}
|
37
lib/widgets/buttons/date_picker_btn.dart
Normal file
@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DatePickerBtn extends StatelessWidget {
|
||||
final String leadingString;
|
||||
final DateTime pickedDate;
|
||||
final void Function(DateTime?) onDatePicked;
|
||||
|
||||
const DatePickerBtn({
|
||||
super.key,
|
||||
required this.leadingString,
|
||||
required this.pickedDate,
|
||||
required this.onDatePicked,
|
||||
});
|
||||
|
||||
void _onButtonPressed(BuildContext context) async {
|
||||
onDatePicked(await showDatePicker(
|
||||
context: context,
|
||||
initialDate: pickedDate,
|
||||
firstDate: DateTime(1900),
|
||||
lastDate: DateTime(2100),
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ThemeData appTheme = Theme.of(context);
|
||||
return TextButton(
|
||||
onPressed: () => _onButtonPressed(context),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: appTheme.primaryTextTheme.labelLarge?.color,
|
||||
backgroundColor: appTheme.colorScheme.secondary,
|
||||
),
|
||||
child: Text(
|
||||
"$leadingString ${pickedDate.toLocal().toString().split(" ")[0]}"),
|
||||
);
|
||||
}
|
||||
}
|
48
lib/widgets/buttons/select_duration_btn.dart
Normal file
@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_picker/flutter_picker.dart';
|
||||
|
||||
class SelectDurationBtn extends StatelessWidget {
|
||||
final Duration duration;
|
||||
final void Function(Duration) updateDuration;
|
||||
|
||||
const SelectDurationBtn({
|
||||
super.key,
|
||||
required this.duration,
|
||||
required this.updateDuration,
|
||||
});
|
||||
|
||||
void _onPickerConfirm(Picker picker, List<int> values) {
|
||||
int years = values[0], months = values[1], days = values[2];
|
||||
days = (years * 365) + (months * 31) + days;
|
||||
Duration newDuration = Duration(days: days);
|
||||
updateDuration(newDuration);
|
||||
}
|
||||
|
||||
void _onButtonPressed(BuildContext context, ThemeData appTheme) => Picker(
|
||||
adapter: NumberPickerAdapter(data: [
|
||||
const NumberPickerColumn(begin: 0, end: 999, suffix: Text(" Y")),
|
||||
const NumberPickerColumn(begin: 0, end: 11, suffix: Text(" M")),
|
||||
const NumberPickerColumn(begin: 0, end: 31, suffix: Text(" D")),
|
||||
]),
|
||||
hideHeader: false,
|
||||
title: const Text("Default Duration"),
|
||||
selectedTextStyle: TextStyle(color: appTheme.colorScheme.secondary),
|
||||
onConfirm: _onPickerConfirm)
|
||||
.showModal(context);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ThemeData appTheme = Theme.of(context);
|
||||
|
||||
int years = duration.inDays ~/ 365;
|
||||
int months = (duration.inDays - (365 * years)) ~/ 30;
|
||||
int days = duration.inDays - (365 * years) - (30 * months);
|
||||
return TextButton(
|
||||
onPressed: () => _onButtonPressed(context, appTheme),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: appTheme.primaryTextTheme.labelLarge?.color,
|
||||
backgroundColor: appTheme.colorScheme.secondary,
|
||||
),
|
||||
child: Text("$years Years $months Months $days Days"));
|
||||
}
|
||||
}
|
89
lib/widgets/detail_screen_floating_action_buttons.dart
Normal file
@ -0,0 +1,89 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
import 'package:time_progress_tracker/widgets/app_yes_no_dialog_widget.dart';
|
||||
|
||||
class DetailScreenFloatingActionButtons extends StatelessWidget {
|
||||
final bool editMode, isEditedProgressValid;
|
||||
final TimeProgress originalProgress, editedProgress;
|
||||
final void Function() onEditProgress,
|
||||
onSaveEditedProgress,
|
||||
onCancelEditProgress,
|
||||
onDeleteProgress;
|
||||
|
||||
const DetailScreenFloatingActionButtons({
|
||||
super.key,
|
||||
required this.editMode,
|
||||
required this.originalProgress,
|
||||
required this.editedProgress,
|
||||
required this.isEditedProgressValid,
|
||||
required this.onEditProgress,
|
||||
required this.onSaveEditedProgress,
|
||||
required this.onCancelEditProgress,
|
||||
required this.onDeleteProgress,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData appTheme = Theme.of(context);
|
||||
|
||||
void onCancelEditTimeProgressBTN() {
|
||||
if (originalProgress == editedProgress) {
|
||||
onCancelEditProgress();
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AppYesNoDialog(
|
||||
titleText: "Cancel Editing of ${originalProgress.name}",
|
||||
contentText:
|
||||
"Are you sure that you want to discard the changes done to ${originalProgress.name}",
|
||||
onYesPressed: () {
|
||||
onCancelEditProgress();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void onDeleteTimeProgressBTN() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => AppYesNoDialog(
|
||||
titleText: "Delete ${originalProgress.name}",
|
||||
contentText: "Are you sure you want to delete this time progress?",
|
||||
onYesPressed: onDeleteProgress,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag:
|
||||
editMode ? "saveEditedTimeProgressBTN" : "editTimeProgressBTN",
|
||||
backgroundColor: editMode ? Colors.green : appTheme.colorScheme.secondary,
|
||||
onPressed: editMode
|
||||
? isEditedProgressValid
|
||||
? onSaveEditedProgress
|
||||
: null
|
||||
: onEditProgress,
|
||||
child: editMode ? const Icon(Icons.save) : const Icon(Icons.edit),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag: editMode
|
||||
? "cancelEditTimeProgressBTN"
|
||||
: "deleteTimeProgressBTN",
|
||||
backgroundColor: Colors.red,
|
||||
onPressed: editMode
|
||||
? onCancelEditTimeProgressBTN
|
||||
: onDeleteTimeProgressBTN,
|
||||
child: editMode ? const Icon(Icons.cancel) : const Icon(Icons.delete),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
45
lib/widgets/home/home_bottom_navbar.dart
Normal file
@ -0,0 +1,45 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomeBottomNavBar extends StatelessWidget {
|
||||
final int currentIndex;
|
||||
final void Function(int)? onTap;
|
||||
|
||||
const HomeBottomNavBar({
|
||||
super.key,
|
||||
required this.currentIndex,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ThemeData appTheme = Theme.of(context);
|
||||
|
||||
return BottomNavigationBar(
|
||||
onTap: onTap,
|
||||
currentIndex: currentIndex,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.alarm,
|
||||
color: appTheme.primaryColor,
|
||||
),
|
||||
label: "Active Progresses",
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.alarm_off,
|
||||
color: appTheme.primaryColor,
|
||||
),
|
||||
label: "Inactive Progresses",
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(
|
||||
Icons.settings,
|
||||
color: appTheme.primaryColor,
|
||||
),
|
||||
label: "Settings",
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
39
lib/widgets/home/tabs/home_active_progresses_tab.dart
Normal file
@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/helper_functions.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_list_view/progress_list_view.dart';
|
||||
import 'package:time_progress_tracker/widgets/store_connectors/settings_store_connector.dart';
|
||||
import 'package:time_progress_tracker/widgets/store_connectors/time_progress_list_store_connector.dart';
|
||||
|
||||
class HomeActiveProgressesTab extends StatelessWidget {
|
||||
const HomeActiveProgressesTab({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SettingsStoreConnector(
|
||||
loadedBuilder: (context, settingsVm) {
|
||||
return TimeProgressListStoreConnector(
|
||||
loadedBuilder: (context, tpListVm) {
|
||||
List<TimeProgress> activeTpList =
|
||||
selectActiveProgresses(tpListVm.tpList);
|
||||
if (activeTpList.isEmpty) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
"You don't have any active time progress, that are tracked."),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ProgressListView(
|
||||
timeProgressList: activeTpList,
|
||||
doneColor: settingsVm.appSettings.doneColor,
|
||||
leftColor: settingsVm.appSettings.leftColor,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
39
lib/widgets/home/tabs/home_inactive_progresses_tab.dart
Normal file
@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/helper_functions.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_list_view/progress_list_view.dart';
|
||||
import 'package:time_progress_tracker/widgets/store_connectors/settings_store_connector.dart';
|
||||
import 'package:time_progress_tracker/widgets/store_connectors/time_progress_list_store_connector.dart';
|
||||
|
||||
class HomeInactiveProgressesTab extends StatelessWidget {
|
||||
const HomeInactiveProgressesTab({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SettingsStoreConnector(
|
||||
loadedBuilder: (context, settingsVm) {
|
||||
return TimeProgressListStoreConnector(
|
||||
loadedBuilder: (context, tpListVm) {
|
||||
List<TimeProgress> inactiveTpList =
|
||||
selectInactiveProgresses(tpListVm.tpList);
|
||||
if (inactiveTpList.isEmpty) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
"You don't have any currently inactive time progresses, that are tracked."),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ProgressListView(
|
||||
timeProgressList: inactiveTpList,
|
||||
doneColor: settingsVm.appSettings.doneColor,
|
||||
leftColor: settingsVm.appSettings.leftColor,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
54
lib/widgets/home/tabs/home_settings_tab.dart
Normal file
@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/app.dart';
|
||||
import 'package:time_progress_tracker/widgets/home/tabs/settings/color_settings_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/home/tabs/settings/duration_settings_widget.dart';
|
||||
import 'package:time_progress_tracker/widgets/store_connectors/settings_store_connector.dart';
|
||||
|
||||
class HomeSettingsTab extends StatelessWidget {
|
||||
const HomeSettingsTab({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SettingsStoreConnector(
|
||||
loadedBuilder: (context, settingsVm) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ColorSettingsWidget(
|
||||
doneColor: settingsVm.appSettings.doneColor,
|
||||
leftColor: settingsVm.appSettings.leftColor,
|
||||
updateDoneColor: settingsVm.updateDoneColor,
|
||||
updateLeftColor: settingsVm.updateLeftColor,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: DurationSettingsWidget(
|
||||
duration: settingsVm.appSettings.duration,
|
||||
updateDuration: settingsVm.updateDuration,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
applicationName: TimeProgressTrackerApp.name,
|
||||
applicationVersion: "Beta",
|
||||
applicationLegalese:
|
||||
'\u00a9Andreas Fahrecker 2020-2021');
|
||||
},
|
||||
child: const Text("About"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
57
lib/widgets/home/tabs/settings/color_settings_widget.dart
Normal file
@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/widgets/buttons/color_picker_btn.dart';
|
||||
|
||||
class ColorSettingsWidget extends StatelessWidget {
|
||||
final Color doneColor, leftColor;
|
||||
final void Function(Color) updateDoneColor, updateLeftColor;
|
||||
|
||||
const ColorSettingsWidget({
|
||||
super.key,
|
||||
required this.doneColor,
|
||||
required this.leftColor,
|
||||
required this.updateDoneColor,
|
||||
required this.updateLeftColor,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ThemeData appTheme = Theme.of(context);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Color Settings",
|
||||
style: appTheme.textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 5),
|
||||
child: ColorPickerButton(
|
||||
title: "Done Color",
|
||||
dialogTitle: "Select Done Color",
|
||||
selectedColor: doneColor,
|
||||
onColorPicked: updateDoneColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 5),
|
||||
child: ColorPickerButton(
|
||||
title: "Left Color",
|
||||
dialogTitle: "Select Left Color",
|
||||
selectedColor: leftColor,
|
||||
onColorPicked: updateLeftColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
42
lib/widgets/home/tabs/settings/duration_settings_widget.dart
Normal file
@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/widgets/buttons/select_duration_btn.dart';
|
||||
|
||||
class DurationSettingsWidget extends StatelessWidget {
|
||||
final Duration duration;
|
||||
final void Function(Duration) updateDuration;
|
||||
|
||||
const DurationSettingsWidget({
|
||||
super.key,
|
||||
required this.duration,
|
||||
required this.updateDuration,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ThemeData appTheme = Theme.of(context);
|
||||
|
||||
//int years = duration.inDays ~/ 365;
|
||||
//int months = (duration.inDays - (365 * years)) ~/ 30;
|
||||
//int days = duration.inDays - (365 * years) - (30 * months);
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Duration Settings",
|
||||
style: appTheme.textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SelectDurationBtn(
|
||||
duration: duration,
|
||||
updateDuration: updateDuration,
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:percent_indicator/circular_percent_indicator.dart';
|
||||
|
||||
class ProgressDetailCircularPercent extends StatelessWidget {
|
||||
final double percentDone;
|
||||
|
||||
ProgressDetailCircularPercent({Key key, @required this.percentDone})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CircularPercentIndicator(
|
||||
radius: 100,
|
||||
lineWidth: 10,
|
||||
percent: percentDone,
|
||||
progressColor: Colors.green,
|
||||
backgroundColor: Colors.red,
|
||||
center: Text("${(percentDone * 100).floor()} %"),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:time_progress_tracker/widgets/progress_detail_widgets/progress_detail_select_date_btn_widget.dart';
|
||||
|
||||
class ProgressDetailEditDatesRow extends StatelessWidget {
|
||||
final DateTime startTime;
|
||||
final DateTime endTime;
|
||||
final void Function(DateTime) onStartTimeChanged;
|
||||
final void Function(DateTime) onEndTimeChanged;
|
||||
|
||||
ProgressDetailEditDatesRow({
|
||||
Key key,
|
||||
@required this.startTime,
|
||||
@required this.endTime,
|
||||
@required this.onStartTimeChanged,
|
||||
@required this.onEndTimeChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: ProgressDetailSelectDateButton(
|
||||
leadingString: "Start Date:",
|
||||
selectedDate: startTime,
|
||||
onDateSelected: onStartTimeChanged,
|
||||
),
|
||||
),
|
||||
Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: ProgressDetailSelectDateButton(
|
||||
leadingString: "End Date:",
|
||||
selectedDate: endTime,
|
||||
onDateSelected: onEndTimeChanged,
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ProgressDetailFabEditingRow extends StatelessWidget {
|
||||
final void Function() onSave;
|
||||
final void Function() onCancelEdit;
|
||||
|
||||
ProgressDetailFabEditingRow({
|
||||
Key key,
|
||||
@required this.onSave,
|
||||
@required this.onCancelEdit,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag: "saveEditedTimeProgressBTN",
|
||||
child: Icon(Icons.save),
|
||||
backgroundColor: Colors.green,
|
||||
onPressed: this.onSave,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag: "cancelEditTimeProgressBTN",
|
||||
child: Icon(Icons.cancel),
|
||||
backgroundColor: Colors.red,
|
||||
onPressed: this.onCancelEdit,
|
||||
))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ProgressDetailFabRow extends StatelessWidget {
|
||||
final void Function() onEdit;
|
||||
final void Function() onDelete;
|
||||
|
||||
ProgressDetailFabRow(
|
||||
{Key key, @required this.onEdit, @required this.onDelete})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag: "editTimeProgressBTN",
|
||||
child: Icon(Icons.edit),
|
||||
onPressed: onEdit,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: FloatingActionButton(
|
||||
heroTag: "deleteTimeProgressBTN",
|
||||
child: Icon(Icons.delete),
|
||||
backgroundColor: Colors.red,
|
||||
onPressed: onDelete,
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:percent_indicator/linear_percent_indicator.dart';
|
||||
import 'package:time_progress_tracker/models/time_progress.dart';
|
||||
|
||||
class ProgressDetailLinearPercent extends StatelessWidget {
|
||||
final TimeProgress timeProgress;
|
||||
|
||||
ProgressDetailLinearPercent({Key key, @required this.timeProgress})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LinearPercentIndicator(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
percent: this.timeProgress.percentDone(),
|
||||
leading: Text("${this.timeProgress.daysBehind()} Days"),
|
||||
center: Text("${(this.timeProgress.percentDone() * 100).floor()} %"),
|
||||
trailing: Text("${this.timeProgress.daysLeft()} Days"),
|
||||
progressColor: Colors.green,
|
||||
backgroundColor: Colors.red,
|
||||
lineHeight: 25,
|
||||
);
|
||||
}
|
||||
}
|