Repository: Mazahir26/koduko
Branch: master
Commit: 867245938a0a
Files: 132
Total size: 358.4 KB
Directory structure:
gitextract__iqieike/
├── .github/
│ └── ISSUE_TEMPLATE/
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── .metadata
├── CODE_OF_CONDUCT.md
├── LICENSE.md
├── README.md
├── analysis_options.yaml
├── android/
│ ├── .gitignore
│ ├── app/
│ │ ├── build.gradle
│ │ └── src/
│ │ ├── debug/
│ │ │ └── AndroidManifest.xml
│ │ ├── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin/
│ │ │ │ └── com/
│ │ │ │ └── example/
│ │ │ │ └── koduko/
│ │ │ │ └── MainActivity.kt
│ │ │ └── res/
│ │ │ ├── drawable/
│ │ │ │ └── launch_background.xml
│ │ │ ├── drawable-v21/
│ │ │ │ └── launch_background.xml
│ │ │ ├── values/
│ │ │ │ └── styles.xml
│ │ │ └── values-night/
│ │ │ └── styles.xml
│ │ └── profile/
│ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle/
│ │ └── wrapper/
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ └── settings.gradle
├── ios/
│ ├── .gitignore
│ ├── Flutter/
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Runner/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ ├── AppIcon.appiconset/
│ │ │ │ └── Contents.json
│ │ │ └── LaunchImage.imageset/
│ │ │ ├── Contents.json
│ │ │ └── README.md
│ │ ├── Base.lproj/
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
│ ├── Runner.xcodeproj/
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace/
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata/
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── Runner.xcscheme
│ └── Runner.xcworkspace/
│ ├── contents.xcworkspacedata
│ └── xcshareddata/
│ ├── IDEWorkspaceChecks.plist
│ └── WorkspaceSettings.xcsettings
├── lib/
│ ├── components/
│ │ ├── card.dart
│ │ ├── create_routine_bottom_sheet.dart
│ │ ├── create_task_bottom_sheet.dart
│ │ ├── daily_activity.dart
│ │ ├── header.dart
│ │ ├── most_productive_hour.dart
│ │ ├── name_page_bottom_sheet.dart
│ │ ├── productive_day.dart
│ │ ├── routine_chart.dart
│ │ ├── routine_tile.dart
│ │ ├── task_tile.dart
│ │ ├── time_spent_today.dart
│ │ └── weekly_chart.dart
│ ├── main.dart
│ ├── models/
│ │ ├── routine.dart
│ │ ├── routine.g.dart
│ │ ├── task.dart
│ │ ├── task.g.dart
│ │ ├── task_event.dart
│ │ └── task_event.g.dart
│ ├── screens/
│ │ ├── about.dart
│ │ ├── app.dart
│ │ ├── archive_routines.dart
│ │ ├── home.dart
│ │ ├── onboarding.dart
│ │ ├── routines.dart
│ │ ├── settings.dart
│ │ ├── start_routine.dart
│ │ ├── stats.dart
│ │ └── tasks.dart
│ ├── services/
│ │ ├── notification_service.dart
│ │ ├── routines_provider.dart
│ │ ├── tasks_provider.dart
│ │ └── theme_provider.dart
│ └── utils/
│ ├── colors_util.dart
│ ├── date_time_extension.dart
│ ├── duration_to_string.dart
│ ├── greetings.dart
│ ├── parse_duration.dart
│ └── time_of_day_util.dart
├── linux/
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter/
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ ├── main.cc
│ ├── my_application.cc
│ └── my_application.h
├── macos/
│ ├── .gitignore
│ ├── Flutter/
│ │ ├── Flutter-Debug.xcconfig
│ │ ├── Flutter-Release.xcconfig
│ │ └── GeneratedPluginRegistrant.swift
│ ├── Runner/
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets/
│ │ │ └── AppIcon.appiconset/
│ │ │ └── Contents.json
│ │ ├── Base.lproj/
│ │ │ └── MainMenu.xib
│ │ ├── Configs/
│ │ │ ├── AppInfo.xcconfig
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ └── Warnings.xcconfig
│ │ ├── DebugProfile.entitlements
│ │ ├── Info.plist
│ │ ├── MainFlutterWindow.swift
│ │ └── Release.entitlements
│ ├── Runner.xcodeproj/
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace/
│ │ │ └── xcshareddata/
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata/
│ │ └── xcschemes/
│ │ └── Runner.xcscheme
│ └── Runner.xcworkspace/
│ ├── contents.xcworkspacedata
│ └── xcshareddata/
│ └── IDEWorkspaceChecks.plist
├── pubspec.yaml
├── test/
│ └── widget_test.dart
├── web/
│ ├── index.html
│ └── manifest.json
└── windows/
├── .gitignore
├── CMakeLists.txt
├── flutter/
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
└── runner/
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .gitignore
================================================
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
*.jks
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
================================================
FILE: .metadata
================================================
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
version:
revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
channel: stable
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
- platform: android
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
- platform: ios
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
- platform: linux
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
- platform: macos
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
- platform: web
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
- platform: windows
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
# 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'
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
================================================
FILE: LICENSE.md
================================================
Copyright 2021 Mazahir
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
# Koduko
Yet another Habit tracker made with flutter.
## ❓ About
It's an open source and free app where you can manage your daily or weekly habits.
## 📢 Getting Started
You can install the latest APK from the [Releases tab](https://github.com/Mazahir26/koduko/releases/latest). You can also download the latest APK from [IzzyOnDroid repo](https://apt.izzysoft.de/fdroid/index/apk/com.example.koduko) within a F-Droid client.
Alternatively you can build the app yourself. See below for further information.
## 🔨 Build
- Clone the repo using `git clone https://github.com/Mazahir26/koduko.git`
- Install all the dependencies `flutter pub get`
- To test it out locally you can check this [guide](https://docs.flutter.dev/development/tools/vs-code)
- To build the apk follow this [guide](https://docs.flutter.dev/deployment/android)
## 👀 Preview


## ⛩️ Features
- Notification Support,
- Material 3 Design,
- No ads,
- Insightful stats,
- And much more..
## 🐞 Found a Bug
If you found any bugs, please open an issue
or [contact me](http://mazahir26.github.io/)
_The app has only been tested on Android._
## 📝 License
This project is licensed under the [MIT License](LICENSE.md).
## ❤️ Thank You
Thanks for checking out my project, I would love to hear feedback, you can [contact](http://mazahir26.github.io/) me via Mail or Telegram.
[](https://www.buymeacoffee.com/mazahir)
================================================
FILE: analysis_options.yaml
================================================
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# require_trailing_commas: true
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
================================================
FILE: android/.gitignore
================================================
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
================================================
FILE: android/app/build.gradle
================================================
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()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def keyStoreProperties= new Properties()
def keyStorePropertiesFile = rootProject.file('key.properties')
if (keyStorePropertiesFile.exists()) {
keyStorePropertiesFile.withReader('UTF-8') {reader ->
keyStoreProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
compileSdkVersion 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'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.koduko"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
storeFile file(keyStoreProperties['storeFile'])
storePassword keyStoreProperties['storePassword']
keyAlias keyStoreProperties['keyAlias']
keyPassword keyStoreProperties['keyPassword']
v1SigningEnabled true
v2SigningEnabled true
enableV3Signing true
enableV4Signing true
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
// buildTypes {
// release {
// // TODO: Add your own signing config for the release build.
// // Signing with the debug keys for now, so `flutter run --release` works.
// signingConfig signingConfigs.debug
// shrinkResources false
// }
// }
}
flutter {
source '../..'
}
dependencies {
}
================================================
FILE: android/app/src/debug/AndroidManifest.xml
================================================
================================================
FILE: android/app/src/main/AndroidManifest.xml
================================================
================================================
FILE: android/app/src/main/kotlin/com/example/koduko/MainActivity.kt
================================================
package com.example.koduko
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
================================================
FILE: android/app/src/main/res/drawable/launch_background.xml
================================================
================================================
FILE: android/app/src/main/res/drawable-v21/launch_background.xml
================================================
================================================
FILE: android/app/src/main/res/values/styles.xml
================================================
================================================
FILE: android/app/src/main/res/values-night/styles.xml
================================================
================================================
FILE: android/app/src/profile/AndroidManifest.xml
================================================
================================================
FILE: android/build.gradle
================================================
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
================================================
FILE: android/gradle/wrapper/gradle-wrapper.properties
================================================
#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-7.4-all.zip
================================================
FILE: android/gradle.properties
================================================
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
================================================
FILE: android/settings.gradle
================================================
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
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.2.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.20" apply false
}
include ":app"
================================================
FILE: ios/.gitignore
================================================
**/dgph
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
================================================
FILE: ios/Flutter/AppFrameworkInfo.plist
================================================
CFBundleDevelopmentRegion
en
CFBundleExecutable
App
CFBundleIdentifier
io.flutter.flutter.app
CFBundleInfoDictionaryVersion
6.0
CFBundleName
App
CFBundlePackageType
FMWK
CFBundleShortVersionString
1.0
CFBundleSignature
????
CFBundleVersion
1.0
MinimumOSVersion
9.0
================================================
FILE: ios/Flutter/Debug.xcconfig
================================================
#include "Generated.xcconfig"
================================================
FILE: ios/Flutter/Release.xcconfig
================================================
#include "Generated.xcconfig"
================================================
FILE: ios/Runner/AppDelegate.swift
================================================
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
================================================
FILE: ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images": [
{
"filename": "AppIcon@2x.png",
"idiom": "iphone",
"scale": "2x",
"size": "60x60"
},
{
"filename": "AppIcon@3x.png",
"idiom": "iphone",
"scale": "3x",
"size": "60x60"
},
{
"filename": "AppIcon~ipad.png",
"idiom": "ipad",
"scale": "1x",
"size": "76x76"
},
{
"filename": "AppIcon@2x~ipad.png",
"idiom": "ipad",
"scale": "2x",
"size": "76x76"
},
{
"filename": "AppIcon-83.5@2x~ipad.png",
"idiom": "ipad",
"scale": "2x",
"size": "83.5x83.5"
},
{
"filename": "AppIcon-40@2x.png",
"idiom": "iphone",
"scale": "2x",
"size": "40x40"
},
{
"filename": "AppIcon-40@3x.png",
"idiom": "iphone",
"scale": "3x",
"size": "40x40"
},
{
"filename": "AppIcon-40~ipad.png",
"idiom": "ipad",
"scale": "1x",
"size": "40x40"
},
{
"filename": "AppIcon-40@2x~ipad.png",
"idiom": "ipad",
"scale": "2x",
"size": "40x40"
},
{
"filename": "AppIcon-20@2x.png",
"idiom": "iphone",
"scale": "2x",
"size": "20x20"
},
{
"filename": "AppIcon-20@3x.png",
"idiom": "iphone",
"scale": "3x",
"size": "20x20"
},
{
"filename": "AppIcon-20~ipad.png",
"idiom": "ipad",
"scale": "1x",
"size": "20x20"
},
{
"filename": "AppIcon-20@2x~ipad.png",
"idiom": "ipad",
"scale": "2x",
"size": "20x20"
},
{
"filename": "AppIcon-29.png",
"idiom": "iphone",
"scale": "1x",
"size": "29x29"
},
{
"filename": "AppIcon-29@2x.png",
"idiom": "iphone",
"scale": "2x",
"size": "29x29"
},
{
"filename": "AppIcon-29@3x.png",
"idiom": "iphone",
"scale": "3x",
"size": "29x29"
},
{
"filename": "AppIcon-29~ipad.png",
"idiom": "ipad",
"scale": "1x",
"size": "29x29"
},
{
"filename": "AppIcon-29@2x~ipad.png",
"idiom": "ipad",
"scale": "2x",
"size": "29x29"
},
{
"filename": "AppIcon-60@2x~car.png",
"idiom": "car",
"scale": "2x",
"size": "60x60"
},
{
"filename": "AppIcon-60@3x~car.png",
"idiom": "car",
"scale": "3x",
"size": "60x60"
},
{
"filename": "AppIcon~ios-marketing.png",
"idiom": "ios-marketing",
"scale": "1x",
"size": "1024x1024"
}
],
"info": {
"author": "iconkitchen",
"version": 1
}
}
================================================
FILE: ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
================================================
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
================================================
FILE: ios/Runner/Base.lproj/LaunchScreen.storyboard
================================================
================================================
FILE: ios/Runner/Base.lproj/Main.storyboard
================================================
================================================
FILE: ios/Runner/Info.plist
================================================
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
Koduko
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
koduko
CFBundlePackageType
APPL
CFBundleShortVersionString
$(FLUTTER_BUILD_NAME)
CFBundleSignature
????
CFBundleVersion
$(FLUTTER_BUILD_NUMBER)
LSRequiresIPhoneOS
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
Main
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UIViewControllerBasedStatusBarAppearance
CADisableMinimumFrameDurationOnPhone
================================================
FILE: ios/Runner/Runner-Bridging-Header.h
================================================
#import "GeneratedPluginRegistrant.h"
================================================
FILE: ios/Runner.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
);
sourceTree = "";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.koduko;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.koduko;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.koduko;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
================================================
FILE: ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
IDEDidComputeMac32BitWarning
================================================
FILE: ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
================================================
PreviewsEnabled
================================================
FILE: ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
================================================
================================================
FILE: ios/Runner.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
IDEDidComputeMac32BitWarning
================================================
FILE: ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
================================================
PreviewsEnabled
================================================
FILE: lib/components/card.dart
================================================
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:koduko/utils/duration_to_string.dart';
class TaskCard extends StatelessWidget {
final String name;
final AnimationController? controller;
final Color color;
final double index;
final void Function(DismissDirection, BuildContext) onDismissed;
final bool isPlaying;
final AnimationController buttonController;
final void Function(TapUpDetails details) onTap;
final bool isCompleted;
final bool isSkipped;
late final Tween tween;
late final Color textColor;
final bool isSwipeDisabled;
TaskCard(
{super.key,
required this.name,
required this.controller,
required this.color,
required this.index,
required this.onDismissed,
required this.isPlaying,
required this.buttonController,
required this.onTap,
required this.isCompleted,
required this.isSkipped,
required this.isSwipeDisabled}) {
if (controller != null) {
if (isCompleted) {
tween = Tween(
begin: 0,
end: 400,
);
} else if (isSkipped) {
tween = Tween(
begin: 0,
end: -400,
);
} else {
tween = Tween(begin: 0, end: 0);
}
} else {
tween = Tween(begin: 0, end: 0);
}
textColor =
color.computeLuminance() > 0.5 ? Colors.grey[800]! : Colors.white;
}
String get timerString {
if (controller == null) {
return "0:00";
}
Duration duration =
controller!.duration! - (controller!.duration! * controller!.value);
return durationToString(duration);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: ConstrainedBox(
constraints: const BoxConstraints(
minHeight: 300,
),
child: TweenAnimationBuilder(
duration: const Duration(milliseconds: 300),
tween: tween,
onEnd: () {
if (isSkipped) {
onDismissed(DismissDirection.endToStart, context);
} else if (isCompleted) {
onDismissed(DismissDirection.startToEnd, context);
}
},
builder: (context, double value, child) => Transform.translate(
offset: Offset(value, 0),
child: child,
),
child: AnimatedRotation(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInCirc,
turns: index < 6 ? index / 200 : 5 / 200,
child: AnimatedPadding(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInCirc,
padding: EdgeInsets.only(
left: index < 6 ? index * 10 : 5 * 10,
bottom: index < 6 ? index * 10 : 5 * 10),
child: Dismissible(
key: UniqueKey(),
confirmDismiss: (direction) {
if (direction == DismissDirection.endToStart &&
isSwipeDisabled) {
return Future((() => false));
}
return Future((() => true));
},
onDismissed: ((direction) => onDismissed(direction, context)),
child: Stack(
alignment: AlignmentDirectional.bottomEnd,
children: [
Container(
height: 300,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color:
Theme.of(context).shadowColor.withOpacity(0.4),
blurRadius: 4.0,
spreadRadius: 0.2,
)
],
),
),
Container(
height: 300,
decoration: BoxDecoration(
color: color.withOpacity(0.4),
borderRadius: BorderRadius.circular(20),
),
),
controller == null
? Container(
height: 40,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(20),
),
)
: AnimatedBuilder(
animation: controller!,
builder: (context, child) {
return Container(
height: controller!.value * 260 + 40,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.only(
bottomLeft: const Radius.circular(20),
bottomRight: const Radius.circular(20),
topLeft: Radius.circular(
controller!.value * 15 + 5,
),
topRight: Radius.circular(
controller!.value * 15 + 5,
),
),
),
);
},
),
// Display's the remaining time of the Task
Positioned(
bottom: 15,
left: 10,
child: controller == null
? Text(
"0:00",
style: TextStyle(
color: textColor,
fontSize: 26,
fontWeight: FontWeight.w500),
)
: AnimatedBuilder(
animation: controller!,
builder: ((context, child) => Text(
timerString,
style: TextStyle(
color: textColor,
fontSize: 26,
fontWeight: FontWeight.w500,
),
))),
),
// The Play-Pause Button on the Card
GestureDetector(
onTapUp: onTap,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: AnimatedIcon(
icon: AnimatedIcons.play_pause,
progress: buttonController,
color: textColor,
size: 45,
),
),
),
// The Name of the Task
Positioned.fill(
child: Align(
child: Text(
name,
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: Theme.of(context)
.textTheme
.apply(displayColor: textColor)
.displaySmall,
),
),
))
],
),
),
),
),
),
),
);
}
}
================================================
FILE: lib/components/create_routine_bottom_sheet.dart
================================================
import 'package:flutter/material.dart';
import 'package:koduko/components/name_page_bottom_sheet.dart';
import 'package:koduko/models/routine.dart';
import 'package:koduko/models/task.dart';
import 'package:koduko/screens/tasks.dart';
import 'package:koduko/services/tasks_provider.dart';
import 'package:koduko/utils/duration_to_string.dart';
import 'package:koduko/utils/parse_duration.dart';
import 'package:koduko/utils/time_of_day_util.dart';
import 'package:provider/provider.dart';
enum RepeatType {
daily,
onlyOn,
}
class CreateRoutineBottomSheet extends StatefulWidget {
const CreateRoutineBottomSheet({
super.key,
this.editRoutine,
});
final Routine? editRoutine;
@override
State createState() =>
_CreateRoutineBottomSheetState();
}
class _CreateRoutineBottomSheetState extends State {
late final PageController _pageController;
late final TextEditingController _nameController;
final List selectedTask = [];
Map selectedDays = {
"Monday": true,
"Tuesday": true,
"Wednesday": true,
"Thursday": true,
"Friday": true,
"Saturday": true,
"Sunday": true,
};
int pageIndex = 0;
bool pageComplected = false;
bool notifications = true;
TimeOfDay? time =
TimeOfDay(hour: TimeOfDay.now().hour + 1, minute: TimeOfDay.now().minute);
@override
void initState() {
_pageController = PageController();
_nameController = TextEditingController();
if (widget.editRoutine != null) {
_nameController.text = widget.editRoutine!.name;
selectedDays = selectedDays.map((key, value) =>
MapEntry(key, widget.editRoutine!.days.contains(key)));
for (var element in widget.editRoutine!.tasks) {
selectedTask.add(element);
}
if (widget.editRoutine!.time != null) {
time = dateTimeToTimeOfDay(widget.editRoutine!.time!);
} else {
notifications = false;
time = TimeOfDay(
hour: TimeOfDay.now().hour + 1, minute: TimeOfDay.now().minute);
}
pageComplected = true;
}
super.initState();
}
void validateName(String _) {
if (_nameController.text.length > 2) {
if (!pageComplected) {
setState(() {
pageComplected = true;
});
}
} else if (pageComplected) {
setState(() {
pageComplected = false;
});
}
}
void onChangeRepeatType(RepeatType r) {
if (r == RepeatType.daily) {
setState(() {
selectedDays = selectedDays.map((key, value) => MapEntry(key, true));
pageComplected = true;
});
} else {
setState(() {
pageComplected = false;
selectedDays = selectedDays.map((key, value) => MapEntry(key, false));
});
}
}
void onDayChange(String e, bool value) {
setState(() {
selectedDays[e] = value;
if (selectedDays.values.contains(true)) {
pageComplected = true;
} else {
pageComplected = false;
}
});
}
// void onTap(bool selected, int index, BuildContext context) {
// if (selected) {
// if (selectedTask.length == 1) {
// setState(() {
// selectedTask.removeWhere((element) =>
// element.id ==
// Provider.of(context, listen: false).tasks[index].id);
// pageComplected = false;
// });
// } else {
// setState(() {
// selectedTask.removeWhere((element) =>
// element.id ==
// Provider.of(context, listen: false).tasks[index].id);
// });
// }
// } else {
// setState(() {
// selectedTask
// .add(Provider.of(context, listen: false).tasks[index]);
// pageComplected = true;
// });
// }
// }
void onAdd(Task t) {
setState(() {
selectedTask.add(t);
pageComplected = true;
});
}
void onRemove(int index) {
if (selectedTask.length == 1) {
setState(() {
selectedTask.removeAt(index);
pageComplected = false;
});
return;
}
setState(() {
selectedTask.removeAt(index);
});
}
@override
void dispose() {
_pageController.dispose();
_nameController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(
top: 10,
right: 10,
left: 10,
bottom: MediaQuery.of(context).viewInsets.bottom + 10),
child: Wrap(
children: [
Center(
child: Column(
children: [
const Icon(
Icons.drag_handle_rounded,
size: 26,
),
Text(
"Create a Routine",
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
),
Padding(
padding: const EdgeInsets.all(15),
child: TweenAnimationBuilder(
duration: const Duration(milliseconds: 250),
tween: Tween(
begin: 0.25,
end: pageIndex == 1
? 0.7
: pageIndex == 0
? 0.25
: 0.4),
builder: (context, value, child) => SizedBox(
height: MediaQuery.of(context).size.height * value,
child: child,
),
child: PageView(
controller: _pageController,
physics: const NeverScrollableScrollPhysics(),
children: [
NamePage(
nameController: _nameController,
validateName: validateName,
pageComplected: pageComplected,
hintText: "ex. Gym",
title: "Routine Name",
),
TaskSelectPage(
onChangeOrder: (oldIndex, newIndex) {
setState(() {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final item = selectedTask.removeAt(oldIndex);
selectedTask.insert(newIndex, item);
});
},
onTapDelete: onRemove,
selectedTask: selectedTask,
onTapAdd: onAdd,
),
RepeatPage(
notification: notifications,
onChangeTime: ((t) => setState(() {
time = t;
})),
onToggleNotification: () => setState(() {
notifications = !notifications;
}),
time: time,
onDayChange: onDayChange,
selectedDays: selectedDays,
onChangeRepeatType: onChangeRepeatType,
)
],
),
),
),
Buttons(
text: pageIndex == 2 ? "Done" : null,
pageIndex: pageIndex,
onPrevious: () {
setState(() {
pageIndex--;
});
if (pageIndex == 0) {
validateName("");
}
if (pageIndex == 1) {
setState(() {
pageComplected = selectedTask.isNotEmpty;
});
}
_pageController.previousPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeIn,
);
},
onNext: pageComplected
? () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
if (pageIndex == 2) {
List temp = [];
selectedDays.forEach((key, value) {
if (value) {
temp.add(key);
}
});
if (widget.editRoutine != null) {
List diff = Routine.taskDiff(
widget.editRoutine!.tasks, selectedTask);
if (selectedTask.length >
widget.editRoutine!.tasks.length) {
diff.addAll(widget.editRoutine!.inCompletedTasks);
} else {
diff = Routine.taskDiff(
diff, widget.editRoutine!.inCompletedTasks);
}
return Navigator.pop(
context,
widget.editRoutine!.copyWith(
tasks: selectedTask,
name: _nameController.text,
days: temp,
time: notifications ? time : null,
inCompletedTasks: diff,
isCompleted: diff.isEmpty,
));
} else {
return Navigator.pop(
context,
Routine.create(
name: _nameController.text,
tasks: selectedTask,
days: temp,
time: notifications
? timeOfDayToDateTime(time)
: null,
),
);
}
}
_pageController.nextPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeIn,
);
if (pageIndex == 0) {
if (selectedTask.isEmpty) {
setState(() {
pageIndex++;
pageComplected = false;
});
return;
}
}
if (pageIndex == 1) {
if (!selectedDays.values.contains(true)) {
setState(() {
pageComplected = false;
pageIndex++;
});
return;
}
}
setState(() {
pageIndex++;
});
}
: null)
],
),
);
}
}
class Buttons extends StatelessWidget {
const Buttons({
super.key,
required this.pageIndex,
required this.onNext,
required this.onPrevious,
required this.text,
});
final int pageIndex;
final void Function()? onNext;
final void Function() onPrevious;
final String? text;
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
flex: 3,
child: pageIndex != 0
? ElevatedButton.icon(
style: ElevatedButton.styleFrom(
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
backgroundColor:
Theme.of(context).colorScheme.secondaryContainer,
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
onPressed: onPrevious,
icon: const Icon(Icons.chevron_left_sharp),
label: Text(
"Back",
style: Theme.of(context).textTheme.bodyLarge,
),
)
: TextButton(
onPressed: (() {
Navigator.pop(context);
}),
child: Text("Cancel",
style: Theme.of(context).textTheme.bodyLarge),
),
),
const Spacer(
flex: 2,
),
Expanded(
flex: 3,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
onPressed: onNext,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
text ?? "Next",
style: Theme.of(context).textTheme.bodyLarge,
),
text == null
? const Icon(Icons.chevron_right_sharp)
: Container()
],
),
),
)
],
);
}
}
class TaskSelectPage extends StatelessWidget {
const TaskSelectPage({
super.key,
required this.selectedTask,
required this.onTapAdd,
required this.onTapDelete,
required this.onChangeOrder,
});
final List selectedTask;
final void Function(Task task) onTapAdd;
final void Function(int index) onTapDelete;
final void Function(int oldIndex, int newIndex) onChangeOrder;
@override
Widget build(BuildContext context) {
return Consumer(builder: ((context, value, child) {
if (value.tasks.isEmpty) {
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Looks like you haven't created any tasks",
style: Theme.of(context).textTheme.titleLarge,
textAlign: TextAlign.center,
),
const SizedBox(height: 10),
TextButton(
onPressed: () {
Navigator.pushNamed(
context,
TasksScreen.routeName,
);
},
child: const Text(
"Create One",
style: TextStyle(fontSize: 18),
))
],
),
);
}
return ReorderableListView(
header: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Select Tasks',
style: Theme.of(context).textTheme.headlineMedium!.apply(
color: Theme.of(context).colorScheme.onSurface)),
TextButton.icon(
onPressed: (() {
Navigator.pushNamed(
context,
TasksScreen.routeName,
);
}),
icon: const Icon(Icons.edit_rounded),
label: Text(
'Edit Tasks',
style: Theme.of(context).textTheme.titleMedium!.apply(
color: Theme.of(context).colorScheme.primary,
),
),
)
],
),
const SizedBox(height: 35),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Selected Tasks',
style: Theme.of(context).textTheme.titleLarge!),
Text(
'Selected (${selectedTask.length})',
style: Theme.of(context)
.textTheme
.titleMedium!
.apply(color: Theme.of(context).colorScheme.primary),
),
],
),
const SizedBox(height: 10),
],
),
footer: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 15),
Text('Tasks', style: Theme.of(context).textTheme.titleLarge!),
const SizedBox(height: 10),
if (value.tasks.isEmpty)
Column(
children: [
const SizedBox(height: 15),
Center(
child: Text('Looks Empty! ',
style: Theme.of(context).textTheme.titleMedium!),
),
TextButton(
onPressed: () {
Navigator.pushNamed(
context,
TasksScreen.routeName,
);
},
child: const Text("Add a Task?"))
],
)
else
...value.tasks
.asMap()
.map((key, value) => MapEntry(
key,
Card(
key: Key('$key+${value.id}'),
child: ListTile(
trailing: TextButton.icon(
icon: const Icon(Icons.add),
label: const Text("ADD"),
onPressed: () => onTapAdd(value),
),
subtitle: Text(
'Duration : ${durationToString(parseDuration(value.duration))} Min',
style: Theme.of(context)
.textTheme
.bodyMedium!
.apply(
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.8)),
),
title: Text(
value.name,
style: Theme.of(context).textTheme.titleMedium,
)),
)))
.values
],
),
onReorder: onChangeOrder,
buildDefaultDragHandles: false,
children: [
if (selectedTask.isEmpty)
Padding(
key: const Key("empty"),
padding: const EdgeInsets.symmetric(vertical: 25),
child: Center(
child: Text('Select a task and it appears here!',
style: Theme.of(context).textTheme.titleMedium!),
),
),
for (int index = 0; index < selectedTask.length; index++)
Card(
key: Key('$index'),
child: ReorderableDelayedDragStartListener(
index: index,
child: ListTile(
leading: IconButton(
icon: const Icon(Icons.remove),
color: Theme.of(context).colorScheme.error,
onPressed: () => onTapDelete(index),
),
trailing: ReorderableDragStartListener(
index: index,
child: const Icon(Icons.drag_handle_rounded),
),
subtitle: Text(
'Duration : ${durationToString(parseDuration(selectedTask[index].duration))} Min',
style: Theme.of(context).textTheme.bodyMedium!.apply(
color: Theme.of(context)
.colorScheme
.onSurface
.withOpacity(0.8)),
),
title: Text(
selectedTask[index].name,
style: Theme.of(context).textTheme.titleMedium,
)),
),
),
],
);
}));
}
}
class RepeatPage extends StatelessWidget {
const RepeatPage({
super.key,
required this.onDayChange,
required this.selectedDays,
required this.onChangeRepeatType,
required this.time,
required this.onChangeTime,
required this.onToggleNotification,
required this.notification,
});
final void Function(String, bool) onDayChange;
final Map selectedDays;
final void Function(RepeatType) onChangeRepeatType;
final TimeOfDay? time;
final void Function(TimeOfDay time) onChangeTime;
final void Function() onToggleNotification;
final bool notification;
@override
Widget build(BuildContext context) {
Future selectTime(BuildContext context) async {
TimeOfDay? pickedTime = await showTimePicker(
context: context,
initialTime: time ?? TimeOfDay.now(),
builder: (context, child) => MediaQuery(
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: false),
child: child ?? Container(),
),
);
if (pickedTime != null && pickedTime != time) {
onChangeTime(pickedTime);
}
}
return ListView(
children: [
Text(
"Repeat",
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(
height: 15,
),
Wrap(
children: [
ChoiceChip(
label: const Text("Daily"),
pressElevation: 0,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.horizontal(left: Radius.circular(5)),
),
selected: !selectedDays.values.contains(false),
backgroundColor: Theme.of(context).colorScheme.onInverseSurface,
onSelected: (value) => onChangeRepeatType(RepeatType.daily),
selectedColor: Theme.of(context).colorScheme.inversePrimary,
labelStyle: Theme.of(context).textTheme.titleMedium,
),
ChoiceChip(
label: const Text("Only on"),
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.horizontal(right: Radius.circular(5)),
),
pressElevation: 0,
selected: selectedDays.values.contains(false),
backgroundColor: Theme.of(context).colorScheme.onInverseSurface,
onSelected: (value) => onChangeRepeatType(RepeatType.onlyOn),
selectedColor: Theme.of(context).colorScheme.inversePrimary,
labelStyle: Theme.of(context).textTheme.titleMedium,
),
],
),
selectedDays.values.contains(false)
? Wrap(
spacing: 2,
runSpacing: -8,
children: selectedDays.keys
.map(
(e) => Padding(
padding: const EdgeInsets.all(4.0),
child: ChoiceChip(
elevation: 3,
label: Text(e),
selected: selectedDays[e] ?? false,
backgroundColor:
Theme.of(context).colorScheme.onInverseSurface,
onSelected: (value) => onDayChange(e, value),
selectedColor:
Theme.of(context).colorScheme.inversePrimary,
labelStyle: Theme.of(context).textTheme.labelMedium,
),
),
)
.toList())
: Container(),
const SizedBox(
height: 15,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Notification",
style: Theme.of(context).textTheme.titleLarge,
),
TextButton.icon(
onPressed: onToggleNotification,
icon: notification
? const Icon(Icons.notifications_active_rounded)
: const Icon(Icons.notifications_off_rounded),
label: notification ? const Text("ON") : const Text("OFF"))
],
),
notification
? Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Select Time",
style: Theme.of(context).textTheme.titleMedium,
),
ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
onPressed: () => selectTime(context),
child: time == null
? const Text("Select Time")
: Text(
time!.format(context),
),
),
],
),
)
: Container()
],
);
}
}
================================================
FILE: lib/components/create_task_bottom_sheet.dart
================================================
import 'package:duration_picker/duration_picker.dart';
import 'package:flutter/material.dart';
import 'package:koduko/components/name_page_bottom_sheet.dart';
import 'package:koduko/models/task.dart';
import 'package:koduko/utils/duration_to_string.dart';
import 'package:koduko/utils/parse_duration.dart';
class CreateTaskBottomSheet extends StatefulWidget {
const CreateTaskBottomSheet({super.key, this.task});
final Task? task;
@override
State createState() => _CreateTaskBottomSheetState();
}
class _CreateTaskBottomSheetState extends State {
late final PageController _pageController;
late final TextEditingController _nameController;
static const chipList = {
"30 sec": Duration(seconds: 30),
"1 min": Duration(minutes: 1),
"2 mins": Duration(minutes: 2),
"5 mins": Duration(minutes: 5),
"10 mins": Duration(minutes: 10),
"15 mins": Duration(minutes: 15),
"20 mins": Duration(minutes: 20),
"25 mins": Duration(minutes: 25),
"30 mins": Duration(minutes: 30),
"Custom": Duration(minutes: 5),
};
static const colorList = [
Colors.blue,
Colors.amber,
Colors.brown,
Colors.yellow,
Colors.teal,
Colors.purple,
Colors.red,
];
Duration customTime = const Duration(minutes: 5);
String? _value;
int? _selectedColor;
int pageIndex = 0;
bool pageComplected = false;
@override
void initState() {
_pageController = PageController();
_nameController = TextEditingController();
if (widget.task != null) {
_nameController.text = widget.task!.name;
_value = chipList.keys.firstWhere((element) =>
chipList[element] == parseDuration(widget.task!.duration));
_selectedColor = colorList
.indexWhere((element) => element.value == widget.task!.color);
pageComplected = true;
}
super.initState();
}
void validateName(String _) {
if (_nameController.text.length > 2) {
if (!pageComplected) {
setState(() {
pageComplected = true;
});
}
} else if (pageComplected) {
setState(() {
pageComplected = false;
});
}
}
void validateDuration() {
if (_value == null) {
setState(() {
pageComplected = false;
});
} else {
setState(() {
pageComplected = true;
});
}
}
void validateColor() {
if (_selectedColor == null) {
setState(() {
pageComplected = false;
});
} else {
setState(() {
pageComplected = true;
});
}
}
void onChangeChip(bool selected, int index, BuildContext context) async {
if (chipList.keys.toList()[index] == 'Custom') {
final r = await showDurationPicker(
context: context,
initialTime: _value != null
? _value == 'Custom'
? customTime
: chipList[_value] ?? customTime
: customTime,
baseUnit: BaseUnit.second,
lowerBound: const Duration(seconds: 15),
upperBound: const Duration(hours: 1),
);
if (r == null) {
return;
}
setState(() {
customTime = r;
_value = 'Custom';
});
validateDuration();
return;
}
setState(() {
_value = selected ? chipList.keys.toList()[index] : null;
});
validateDuration();
}
// Future onCustomDurationSelect(BuildContext context) async {
// final result = await Picker(
// adapter: NumberPickerAdapter(data: [
// const NumberPickerColumn(begin: 0, end: 30, suffix: Text(' minutes')),
// const NumberPickerColumn(begin: 5, end: 60, suffix: Text(' seconds')),
// ]),
// backgroundColor: Theme.of(context).colorScheme.surface,
// onBuilderItem: (context, text, child, selected, col, index) {
// String t = text == null
// ? ''
// : col == 0
// ? '$text min'
// : '$text sec';
// return Center(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: [
// Text(
// t,
// style: selected
// ? Theme.of(context)
// .textTheme
// .titleLarge!
// .apply(color: Theme.of(context).colorScheme.primary)
// : Theme.of(context).textTheme.titleMedium,
// )
// ],
// ),
// );
// },
// looping: true,
// magnification: 1.1,
// itemExtent: 50,
// hideHeader: true,
// confirmText: 'Select',
// title: const Text('Select duration'),
// onConfirm: (Picker picker, List value) {
// Duration duration = Duration(
// minutes: picker.getSelectedValues()[0],
// seconds: picker.getSelectedValues()[1]);
// setState(() {
// customTime = duration;
// });
// validateDuration();
// },
// ).showDialog(context);
// if (result == null) {
// return false;
// } else {
// return true;
// }
// }
void onChangeColor(int index) {
setState(() {
_selectedColor = index;
});
validateColor();
}
@override
void dispose() {
_pageController.dispose();
_nameController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(
top: 10,
right: 10,
left: 10,
bottom: MediaQuery.of(context).viewInsets.bottom + 10),
child: Wrap(
children: [
Center(
child: Column(
children: [
const Icon(
Icons.drag_handle_rounded,
size: 26,
),
Text(
"Create a Task",
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
),
Padding(
padding: const EdgeInsets.all(15),
child: SizedBox(
height: MediaQuery.of(context).size.height / 4,
child: PageView(
controller: _pageController,
physics: const NeverScrollableScrollPhysics(),
children: [
NamePage(
nameController: _nameController,
validateName: validateName,
pageComplected: pageComplected,
hintText: "ex. push up",
title: "Task Name",
),
DurationPage(
customDuration: customTime,
onChange: onChangeChip,
chipList: chipList,
value: _value,
),
ColorPage(
onChange: onChangeColor,
colorList: colorList,
selectedColor: _selectedColor,
)
],
),
),
),
Buttons(
text: pageIndex == 2 ? "Done" : null,
pageIndex: pageIndex,
onPrevious: () {
setState(() {
pageIndex--;
});
if (pageIndex == 0) {
validateName("");
}
if (pageIndex == 1) {
validateDuration();
}
_pageController.previousPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeIn,
);
},
onNext: pageComplected
? () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
setState(() {
pageIndex++;
});
if (pageIndex == 1) {
validateDuration();
}
if (pageIndex == 2) {
validateColor();
}
if (pageIndex == 3) {
final dur = _value! == 'Custom'
? customTime
: chipList[_value]!;
Navigator.pop(
context,
Task.fromDuration(
duration: dur,
name: _nameController.text,
color: colorList[_selectedColor!]));
}
_pageController.nextPage(
duration: const Duration(milliseconds: 350),
curve: Curves.easeIn,
);
}
: null)
],
),
);
}
}
class Buttons extends StatelessWidget {
const Buttons({
super.key,
required this.pageIndex,
required this.onNext,
required this.onPrevious,
required this.text,
});
final int pageIndex;
final void Function()? onNext;
final void Function() onPrevious;
final String? text;
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
flex: 3,
child: pageIndex != 0
? ElevatedButton.icon(
style: ElevatedButton.styleFrom(
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
backgroundColor:
Theme.of(context).colorScheme.secondaryContainer,
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
onPressed: onPrevious,
icon: const Icon(Icons.chevron_left_sharp),
label: Text(
"Back",
style: Theme.of(context).textTheme.bodyLarge,
),
)
: TextButton(
onPressed: (() {
Navigator.pop(context);
}),
child: Text("Cancel",
style: Theme.of(context).textTheme.bodyLarge),
),
),
const Spacer(
flex: 2,
),
Expanded(
flex: 3,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
foregroundColor:
Theme.of(context).colorScheme.onSecondaryContainer,
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
onPressed: onNext,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
text ?? "Next",
style: Theme.of(context).textTheme.bodyLarge,
),
text == null
? const Icon(Icons.chevron_right_sharp)
: Container()
],
),
),
)
],
);
}
}
class DurationPage extends StatelessWidget {
const DurationPage(
{super.key,
required this.onChange,
required this.chipList,
required this.value,
required this.customDuration});
final void Function(bool, int, BuildContext) onChange;
final Map chipList;
final String? value;
final Duration customDuration;
@override
Widget build(BuildContext context) {
return ListView(
children: [
Text(
"Select a Duration",
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(
height: 15,
),
Wrap(
spacing: 6,
children: List.generate(
chipList.length,
(index) => ChoiceChip(
label: Text(
value == 'Custom' && chipList.keys.toList()[index] == 'Custom'
? '${durationToString(customDuration)} min'
: chipList.keys.toList()[index]),
selected: value == chipList.keys.toList()[index],
selectedColor:
Theme.of(context).colorScheme.primary.withOpacity(0.7),
backgroundColor:
Theme.of(context).colorScheme.primary.withOpacity(0.15),
labelStyle: Theme.of(context).textTheme.labelLarge!.apply(
color: value == chipList.keys.toList()[index]
? Theme.of(context).colorScheme.onSecondary
: Theme.of(context).colorScheme.onSurface),
onSelected: (bool selected) => onChange(selected, index, context),
),
),
),
],
);
}
}
class ColorPage extends StatelessWidget {
const ColorPage(
{super.key,
required this.onChange,
required this.colorList,
required this.selectedColor});
final void Function(int) onChange;
final List colorList;
final int? selectedColor;
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Pick a Color",
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(
height: 15,
),
Wrap(
spacing: 5,
children: List.generate(
colorList.length,
(index) => GestureDetector(
onTap: () => onChange(index),
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
padding: const EdgeInsets.all(3),
decoration: BoxDecoration(
border: Border.all(
color: selectedColor == index
? Colors.blueAccent
: Theme.of(context).colorScheme.surface,
width: 3,
),
shape: BoxShape.circle,
),
child: Container(
height: selectedColor == index ? 25 : 20,
width: selectedColor == index ? 25 : 20,
decoration: BoxDecoration(
boxShadow: const [
BoxShadow(
color: Colors.grey,
offset: Offset(0.0, 1.0), //(x,y)
blurRadius: 6.0,
),
],
color: colorList[index],
shape: BoxShape.circle,
),
),
),
)),
),
],
);
}
}
================================================
FILE: lib/components/daily_activity.dart
================================================
import 'package:flutter/material.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
import 'package:provider/provider.dart';
class TodayProgress extends StatelessWidget {
const TodayProgress({
super.key,
required this.textTheme,
});
final TextTheme textTheme;
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.symmetric(vertical: 10),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 15),
child: Consumer(builder: ((context, value, child) {
var inT = value.totalNoOfCompletedTasksToday();
var t = value.totalNoOfTasksToday();
double per;
if (t == 0) {
per = 0;
} else {
per = inT / t;
}
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${value.totalNoOfCompletedTasksToday()}/${value.totalNoOfTasksToday()}',
style: textTheme.headlineLarge,
),
Text(
"Today's Progress",
style: textTheme.titleMedium,
)
],
),
Stack(
alignment: AlignmentDirectional.center,
children: [
CircularPercentIndicator(
percent: per,
backgroundColor:
Theme.of(context).colorScheme.surfaceContainerHighest,
backgroundWidth: 15,
progressColor: Theme.of(context).colorScheme.inversePrimary,
animation: true,
circularStrokeCap: CircularStrokeCap.round,
radius: 40,
lineWidth: 8,
),
Text(
'${(per * 100).toInt()}%',
style: textTheme.titleSmall!.apply(fontWeightDelta: 1),
)
],
)
],
);
})),
),
);
}
}
================================================
FILE: lib/components/header.dart
================================================
import 'package:flutter/material.dart';
class ScreenHeader extends StatelessWidget {
const ScreenHeader({super.key, required this.text, required this.tag});
final String text;
final String tag;
@override
Widget build(BuildContext context) {
return Row(
children: [
Expanded(
flex: 1,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: const Icon(
Icons.arrow_back_ios,
size: 30,
),
),
),
Expanded(
flex: 10,
child: Hero(
tag: tag,
child: Text(
text,
style: Theme.of(context)
.textTheme
.headlineLarge!
.apply(color: Theme.of(context).colorScheme.onSurface),
textAlign: TextAlign.center,
),
),
),
],
);
}
}
================================================
FILE: lib/components/most_productive_hour.dart
================================================
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:koduko/utils/time_of_day_util.dart';
import 'package:provider/provider.dart';
class ProductiveHour extends StatelessWidget {
const ProductiveHour({super.key, required this.textTheme});
final TextTheme textTheme;
@override
Widget build(BuildContext context) {
return Card(
child: Selector(
selector: (p0, p1) => p1.getMostProductiveHour(),
builder: (context, value, child) => Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
const SizedBox(height: 15),
Text(
"Most Productive Hour",
style: textTheme.titleSmall,
),
const SizedBox(height: 10),
Text(
DateFormat.j().format(
timeOfDayToDateTime(TimeOfDay(hour: value, minute: 0)) ??
DateTime.now()),
style: textTheme.headlineLarge,
),
const SizedBox(height: 15),
],
),
),
));
}
}
================================================
FILE: lib/components/name_page_bottom_sheet.dart
================================================
import 'package:flutter/material.dart';
class NamePage extends StatelessWidget {
const NamePage(
{super.key,
required this.nameController,
required this.validateName,
required this.pageComplected,
required this.hintText,
required this.title});
final TextEditingController nameController;
final void Function(String) validateName;
final bool pageComplected;
final String hintText;
final String title;
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(
height: 25,
),
TextField(
controller: nameController,
autofocus: true,
maxLength: 20,
onChanged: validateName,
decoration: InputDecoration(
suffixIcon: pageComplected ? const Icon(Icons.check) : null,
filled: true,
hintText: hintText,
errorText:
nameController.text.length > 2 || nameController.text.isEmpty
? null
: "Invalid Name",
),
)
],
);
}
}
================================================
FILE: lib/components/productive_day.dart
================================================
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:provider/provider.dart';
class ProductiveDay extends StatelessWidget {
const ProductiveDay({super.key, required this.textTheme});
final TextTheme textTheme;
@override
Widget build(BuildContext context) {
return Card(
child: Selector(
selector: (p0, p1) => p1.getMostProductiveDay(),
builder: (context, value, child) => Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
const SizedBox(height: 15),
Text(
"Most Productive Day",
style: textTheme.titleSmall,
),
const SizedBox(height: 10),
Text(
value == null ? 'NaN' : DateFormat('EEEE').format(value),
style: textTheme.headlineLarge,
),
const SizedBox(height: 15),
],
),
),
));
}
}
================================================
FILE: lib/components/routine_chart.dart
================================================
import 'dart:math';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:koduko/models/routine.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:provider/provider.dart';
class RoutineChart extends StatelessWidget {
const RoutineChart({super.key, required this.routine});
// final List gradientColors = [
// const Color(0xff6f7bf7),
// const Color(0xff9bf8f4),
// ];
final Routine routine;
@override
Widget build(BuildContext context) {
return Consumer(builder: (context, value, child) {
double maxX =
value.getRoutineStartMaxDays(routine.id).toDouble().clamp(0, 7);
double maxY = value.getRoutineStats(routine.id).isNotEmpty
? value.getRoutineStats(routine.id).reduce(max).toDouble()
: 10;
Color c = Theme.of(context).brightness == Brightness.light
? Colors.black12
: Colors.grey[800]!;
final showChart = maxX >= 1 ? true : false;
if (!showChart) {
return Padding(
padding: const EdgeInsets.all(15),
child: Text(
"${routine.name.trim()}'s activity will show up here. ",
style: Theme.of(context).textTheme.bodyLarge,
textAlign: TextAlign.center,
),
);
}
return Column(
children: [
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"${routine.name.trim()}'s Activity",
style: Theme.of(context).textTheme.titleLarge,
),
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 15,
),
child: SizedBox(
height: 200,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: LineChart(
LineChartData(
titlesData: FlTitlesData(
show: true,
rightTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
topTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 30,
interval: 1,
getTitlesWidget: ((v, meta) => bottomTitleWidgets(
v, c, meta, value.getStartDate(routine.id))),
),
),
leftTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: false,
reservedSize: 30,
interval: 1,
getTitlesWidget: ((v, meta) =>
leftTitleWidgets(v, c, meta)),
),
),
),
gridData: FlGridData(
show: true,
drawVerticalLine: true,
horizontalInterval: 1,
verticalInterval: 1,
getDrawingHorizontalLine: (value) {
return FlLine(
color: c,
strokeWidth: 1,
);
},
getDrawingVerticalLine: (value) {
return FlLine(
color: c,
strokeWidth: 1,
);
},
),
borderData: FlBorderData(
show: true, border: Border.all(color: c, width: 1)),
minX: 0,
maxX: maxX,
minY: -0.2,
maxY: maxY + 1,
lineBarsData: [
LineChartBarData(
spots: value
.getRoutineStats(routine.id)
.asMap()
.map((key, value) => MapEntry(
key, FlSpot(key.toDouble(), value.toDouble())))
.values
.toList(),
isCurved: true,
curveSmoothness: 0.5,
barWidth: 3,
color: Theme.of(context).colorScheme.primary,
dotData: const FlDotData(
show: true,
),
belowBarData: BarAreaData(
show: true,
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.4),
),
),
],
),
),
),
),
),
],
);
});
}
}
Widget bottomTitleWidgets(
double value, Color c, TitleMeta meta, DateTime start) {
final style = TextStyle(
color: c,
fontWeight: FontWeight.bold,
fontSize: 12,
);
return SideTitleWidget(
axisSide: meta.axisSide,
space: 8.0,
child: Text(
DateFormat('dd/MM').format(start.add(Duration(days: value.toInt()))),
style: style),
);
}
Widget leftTitleWidgets(double value, Color c, TitleMeta meta) {
final style = TextStyle(
color: c,
fontWeight: FontWeight.bold,
fontSize: 12,
);
if (value < 0) {
return Container();
}
return Text(
value.toInt().toString(),
style: style,
textAlign: TextAlign.center,
);
}
================================================
FILE: lib/components/routine_tile.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:koduko/components/create_routine_bottom_sheet.dart';
import 'package:koduko/components/routine_chart.dart';
import 'package:koduko/models/routine.dart';
import 'package:koduko/screens/start_routine.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:percent_indicator/linear_percent_indicator.dart';
import 'package:provider/provider.dart';
class RoutineTile extends StatefulWidget {
const RoutineTile({
super.key,
required this.routine,
this.isToday = false,
required this.onEdit,
});
final Routine routine;
final bool isToday;
final void Function(Routine) onEdit;
@override
State createState() => _RoutineTileState();
}
class _RoutineTileState extends State {
void onLongPress(BuildContext context) async {
Routine? r = await showModalBottomSheet(
isScrollControlled: true,
isDismissible: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(10),
bottom: Radius.zero,
),
),
context: context,
builder: ((context) => CreateRoutineBottomSheet(
editRoutine: widget.routine,
)));
if (r != null) {
widget.onEdit(r);
}
}
void onExpanded(bool value) {
setState(() {
isExpanded = value;
});
}
void onPress(BuildContext context) {
Navigator.push(
context,
MaterialPageRoute(
builder: ((context) => RoutineScreen(
routine: widget.routine.id,
))));
}
bool isExpanded = false;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(2),
child: Slidable(
enabled: !isExpanded,
closeOnScroll: true,
key: Key(widget.routine.id),
startActionPane: ActionPane(
motion: const ScrollMotion(),
dismissible: DismissiblePane(
closeOnCancel: true,
onDismissed: () {
Provider.of(context, listen: false)
.addToArchive(widget.routine.id);
}),
children: [
Action(
onPress: ((context) {
Provider.of(context, listen: false)
.addToArchive(widget.routine.id);
}),
color: Colors.brown[300]!,
icon: Icons.archive_rounded,
label: 'Archive',
),
],
),
endActionPane: ActionPane(
motion: const ScrollMotion(),
children: [
Action(
onPress: ((context) {
Provider.of(context, listen: false)
.toggleMarkAsCompleted(widget.routine.id);
}),
color: Colors.blue[300]!,
icon: Icons.checklist_rounded,
label: widget.routine.isCompleted
? 'Mark as Incomplete'
: 'Mark as Completed',
),
],
),
child: Card(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: CustomTile(
isOpen: isExpanded,
onStateChange: onExpanded,
isToday: widget.isToday,
routine: widget.routine,
onPress: onPress,
onEdit: onLongPress,
onDelete: ((context) {
showDialog(
context: context,
builder: ((context) => AlertOnDelete(
onCancel: () {
Navigator.pop(context);
},
onDelete: (() {
Provider.of(context, listen: false)
.delete(widget.routine.id);
Navigator.pop(context);
}),
)),
);
}),
))),
),
);
}
}
class AlertOnDelete extends StatelessWidget {
const AlertOnDelete({
super.key,
required this.onCancel,
required this.onDelete,
});
final void Function() onCancel;
final void Function() onDelete;
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text("Delete routine?"),
content: const Text(
"This routine will be deleted. This will remove all the history of this routine as well."),
actions: [
TextButton(
onPressed: onCancel,
child: const Text("CANCEL"),
),
TextButton(
style: TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error),
onPressed: onDelete,
child: const Text("DELETE"),
)
],
);
}
}
class Action extends StatelessWidget {
const Action(
{super.key,
required this.onPress,
required this.color,
required this.icon,
required this.label});
final Function(BuildContext context) onPress;
final Color color;
final IconData icon;
final String label;
@override
Widget build(BuildContext context) {
return Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Center(
child: TextButton.icon(
onPressed: (() {
onPress(context);
Slidable.of(context)?.close();
}),
icon: Icon(
icon,
color: color,
),
label: Text(
label,
style: Theme.of(context).textTheme.titleMedium!.apply(color: color),
),
)),
),
);
}
}
class CustomTile extends StatelessWidget {
const CustomTile({
super.key,
required this.isToday,
required this.routine,
required this.onPress,
required this.onDelete,
required this.onEdit,
required this.onStateChange,
required this.isOpen,
});
final bool isToday;
final Routine routine;
final Function(BuildContext context) onPress;
final Function(BuildContext context) onDelete;
final Function(BuildContext context) onEdit;
final Function(bool value) onStateChange;
final bool isOpen;
// bool isOpen = false;
@override
Widget build(BuildContext context) {
return Theme(
data: Theme.of(context).copyWith(
dividerColor: Colors.transparent,
splashFactory: NoSplash.splashFactory,
highlightColor: Colors.transparent,
),
child: ExpansionTile(
onExpansionChanged: (value) {
Slidable.of(context)?.close();
onStateChange(value);
},
title: Hero(
tag: routine.name,
child: Text(
routine.name,
style: Theme.of(context).textTheme.titleLarge,
),
),
subtitle: isToday
? Padding(
padding: const EdgeInsets.symmetric(vertical: 3),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (routine.inCompletedTasks.isEmpty)
const Text("Completed")
else
AnimatedCrossFade(
firstChild: Text(
'Completed ${routine.tasks.length - routine.inCompletedTasks.length} out of ${routine.tasks.length}'),
secondChild: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
"${routine.getTimeLeft().inMinutes} mins left"),
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: Text(
'Completed ${routine.tasks.length - routine.inCompletedTasks.length} / ${routine.tasks.length}',
style: const TextStyle(
fontSize: 12,
),
),
),
)
],
),
crossFadeState: isOpen
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
duration: const Duration(milliseconds: 300),
),
const SizedBox(height: 5),
LinearPercentIndicator(
animateFromLastPercent: true,
animation: true,
percent: routine.getPercentage().clamp(0, 1),
barRadius: const Radius.circular(10),
lineHeight: 3,
progressColor:
Theme.of(context).colorScheme.inversePrimary,
padding: EdgeInsets.zero,
),
],
),
)
: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(routine.getDays()),
Text("${routine.getTotalTime().inMinutes} mins")
],
),
trailing: IconButton(
padding: EdgeInsets.zero,
onPressed: () {
onPress(context);
},
icon: isToday
? Icon(
routine.isCompleted
? Icons.replay_rounded
: Icons.play_arrow_rounded,
size: 30,
)
: const Icon(
Icons.play_arrow_rounded,
size: 30,
),
),
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"Total duration ${routine.getTotalTime().inMinutes} mins")),
),
RoutineChart(routine: routine),
Theme(
data: Theme.of(context),
child: Row(
children: [
Expanded(
child: TextButton.icon(
onPressed: () => onDelete(context),
icon: Icon(
Icons.delete,
color: Colors.red[300],
),
label: Text(
'Delete',
style: Theme.of(context)
.textTheme
.bodyMedium!
.apply(color: Colors.red[300]),
),
),
),
Expanded(
child: TextButton.icon(
onPressed: () => onEdit(context),
icon: Icon(
Icons.edit,
color: Colors.blue[300],
),
label: Text(
'Edit',
style: Theme.of(context)
.textTheme
.bodyMedium!
.apply(color: Colors.blue[300]),
),
),
),
],
),
)
],
),
);
}
}
================================================
FILE: lib/components/task_tile.dart
================================================
import 'package:flutter/material.dart';
import 'package:koduko/components/create_task_bottom_sheet.dart';
import 'package:koduko/models/task.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:koduko/services/tasks_provider.dart';
import 'package:koduko/utils/duration_to_string.dart';
import 'package:koduko/utils/parse_duration.dart';
import 'package:provider/provider.dart';
class TaskTile extends StatelessWidget {
const TaskTile({super.key, required this.task, required this.onEdit});
final Task task;
final void Function(Task) onEdit;
@override
Widget build(BuildContext context) {
return Card(
child: ListTile(
trailing: SizedBox(
width: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () async {
Task? t = await showModalBottomSheet(
isScrollControlled: true,
isDismissible: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(10),
bottom: Radius.zero,
),
),
context: context,
builder: ((context) => CreateTaskBottomSheet(
task: task,
)));
if (t != null) {
onEdit(task.copyWith(
color: t.color, duration: t.duration, name: t.name));
}
},
icon: const Icon(Icons.edit)),
IconButton(
onPressed: () async {
showDialog(
context: context,
builder: ((context) => AlertDialog(
title: const Text("Delete task?"),
content: const Text(
"This Task will be removed from all the routines. if the routine has only this task, then routine will also be deleted."),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("CANCEL"),
),
TextButton(
style: TextButton.styleFrom(
foregroundColor:
Theme.of(context).colorScheme.error),
onPressed: () {
Provider.of(context,
listen: false)
.delete(task.id);
Provider.of(context,
listen: false)
.removeTask(task);
Navigator.pop(context);
},
child: const Text("DELETE"),
)
],
)));
},
icon: Icon(
Icons.delete,
color: Colors.red[300],
))
],
),
),
subtitle: Text(
'Duration : ${durationToString(parseDuration(task.duration))} Min'),
title: Text(
task.name,
style: Theme.of(context).textTheme.bodyMedium,
),
),
);
}
}
================================================
FILE: lib/components/time_spent_today.dart
================================================
import 'package:flutter/material.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:provider/provider.dart';
class TimeSpentToday extends StatelessWidget {
const TimeSpentToday({super.key, required this.textTheme});
final TextTheme textTheme;
@override
Widget build(BuildContext context) {
return Card(
child: Selector(
selector: (p0, p1) => p1.getTimeSpentToday(),
builder: (context, value, child) => Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
const SizedBox(height: 15),
Text(
"Time Spent Today",
style: textTheme.titleSmall,
),
const SizedBox(height: 10),
Text(
"$value mins",
style: textTheme.headlineLarge,
),
const SizedBox(height: 15),
],
),
),
));
}
}
================================================
FILE: lib/components/weekly_chart.dart
================================================
import 'dart:math';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:provider/provider.dart';
import 'package:collection/collection.dart';
class WeeklyChart extends StatefulWidget {
const WeeklyChart({
super.key,
required this.textTheme,
});
final TextTheme textTheme;
@override
State createState() => _WeeklyChartState();
}
class _WeeklyChartState extends State {
int index = -1;
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.symmetric(vertical: 10),
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Weekly Activity',
style: widget.textTheme.headlineSmall!
.apply(fontWeightDelta: 1)),
Consumer(
builder: ((context, value, child) => Text(
'You have completed ${value.getWeeklyStats().sum} ${value.getWeeklyStats().sum > 1 ? "tasks" : "task"} this week.',
style: widget.textTheme.bodyMedium)),
),
const SizedBox(height: 15),
SizedBox(
height: 160,
child: Consumer(
builder: ((context, value, child) {
var barGroupData = value
.getWeeklyStats()
.asMap()
.map((key, val) => MapEntry(
key,
BarChartGroupData(
x: key,
barRods: [
BarChartRodData(
width: 15,
backDrawRodData: BackgroundBarChartRodData(
color: Theme.of(context)
.colorScheme
.surfaceContainerHighest,
show: true,
toY: value
.getWeeklyStats()
.reduce(max)
.toDouble() ==
0
? 10
: value
.getWeeklyStats()
.reduce(max)
.toDouble(),
),
toY: val.toDouble(),
color: key == index
? Theme.of(context)
.colorScheme
.primary
.withOpacity(0.5)
: Theme.of(context)
.colorScheme
.inversePrimary,
),
],
)))
.values
.toList();
return BarChart(
swapAnimationDuration:
const Duration(milliseconds: 250), // Optional
swapAnimationCurve: Curves.bounceOut,
BarChartData(
barTouchData: BarTouchData(
touchTooltipData: barToolTipData(context),
touchCallback:
(FlTouchEvent event, barTouchResponse) {
setState(() {
if (!event.isInterestedForInteractions ||
barTouchResponse == null ||
barTouchResponse.spot == null) {
index = -1;
return;
}
index = barTouchResponse
.spot!.touchedBarGroupIndex;
});
},
),
borderData: FlBorderData(show: false),
gridData: const FlGridData(show: false),
alignment: BarChartAlignment.spaceAround,
titlesData: FlTitlesData(
show: true,
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 40,
getTitlesWidget: ((value, meta) => getTitles(
value,
meta,
Theme.of(context).colorScheme.onSurface,
Theme.of(context)
.colorScheme
.inversePrimary)),
),
),
leftTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
topTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
rightTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
),
barGroups: barGroupData,
));
}),
)),
],
),
));
}
}
Widget getTitles(double value, TitleMeta meta, Color color, Color backColor) {
var style = TextStyle(
color: color,
);
String text;
switch (value.toInt()) {
case 0:
text = 'Mon';
break;
case 1:
text = 'Tue';
break;
case 2:
text = 'Wed';
break;
case 3:
text = 'Thu';
break;
case 4:
text = 'Fri';
break;
case 5:
text = 'Sat';
break;
case 6:
text = 'Sun';
break;
default:
text = '';
break;
}
return SideTitleWidget(
axisSide: meta.axisSide,
space: 4.0,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
margin: const EdgeInsets.only(top: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: DateFormat("EEE").format(DateTime.now()) == text
? backColor.withOpacity(0.5)
: null),
child: Text(text, style: style)),
);
}
BarTouchTooltipData barToolTipData(BuildContext context) {
return BarTouchTooltipData(
getTooltipItem: (group, groupIndex, rod, rodIndex) {
String weekDay;
switch (group.x.toInt()) {
case 0:
weekDay = 'Monday';
break;
case 1:
weekDay = 'Tuesday';
break;
case 2:
weekDay = 'Wednesday';
break;
case 3:
weekDay = 'Thursday';
break;
case 4:
weekDay = 'Friday';
break;
case 5:
weekDay = 'Saturday';
break;
case 6:
weekDay = 'Sunday';
break;
default:
throw Error();
}
return BarTooltipItem(
'$weekDay\n',
Theme.of(context).textTheme.labelLarge!,
children: [
TextSpan(
text: '${rod.toY}',
style: Theme.of(context).textTheme.labelMedium!),
],
);
},
);
}
================================================
FILE: lib/main.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter_native_timezone/flutter_native_timezone.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:koduko/models/routine.dart';
import 'package:koduko/models/task.dart';
import 'package:koduko/models/task_event.dart';
import 'package:koduko/screens/about.dart';
import 'package:koduko/screens/app.dart';
import 'package:koduko/screens/archive_routines.dart';
import 'package:koduko/screens/onboarding.dart';
import 'package:koduko/screens/stats.dart';
import 'package:koduko/screens/tasks.dart';
import 'package:koduko/services/notification_service.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:koduko/services/tasks_provider.dart';
import 'package:koduko/services/theme_provider.dart';
import 'package:provider/provider.dart';
import 'package:timezone/data/latest_all.dart' as tz;
import 'package:timezone/timezone.dart' as tz;
void main() async {
await Hive.initFlutter();
Hive.registerAdapter(TaskAdapter());
Hive.registerAdapter(RoutineAdapter());
Hive.registerAdapter(TaskEventAdapter());
WidgetsFlutterBinding.ensureInitialized();
await NotificationService().initialize();
_configureLocalTimeZone();
runApp(const MyApp());
}
Future _configureLocalTimeZone() async {
tz.initializeTimeZones();
final String timeZoneName = await FlutterNativeTimezone.getLocalTimezone();
tz.setLocalLocation(tz.getLocation(timeZoneName));
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: Future.wait([
Hive.openBox("Routines"),
Hive.openBox("Tasks"),
Hive.openBox("Theme"),
]),
builder: (context, snapshot) {
if (snapshot.hasError) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Text(
"Oops! Try again later",
style: Theme.of(context).textTheme.displayMedium,
),
),
),
);
} else if (snapshot.hasData) {
final box = Hive.box('Theme');
String initRoute = '/';
if (box.isOpen) {
initRoute =
(box.get('isNewUser') ?? true) ? OnBoarding.routeName : '/';
}
return MultiProvider(
providers: [
ChangeNotifierProvider(
create: (context) => RoutineModel(),
),
ChangeNotifierProvider(
create: (context) => TaskModel(),
),
ChangeNotifierProvider(
create: ((context) => ThemeModel()),
),
],
child: Consumer(
builder: (context, value, child) => MaterialApp(
debugShowCheckedModeBanner: false,
title: 'KudoKo',
themeMode: value.getTheme,
theme: ThemeData.light(useMaterial3: true).copyWith(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.purple,
brightness: Brightness.light,
),
),
darkTheme: ThemeData.dark(useMaterial3: true).copyWith(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.purple,
brightness: Brightness.dark,
),
),
initialRoute: initRoute,
routes: {
TasksScreen.routeName: (context) => const TasksScreen(),
App.routeName: (context) => const App(),
AboutScreen.routeName: (context) => const AboutScreen(),
Statistics.routeName: ((context) => const Statistics()),
ArchiveRoutinesScreen.routeName: ((context) =>
const ArchiveRoutinesScreen()),
OnBoarding.routeName: (((context) => const OnBoarding()))
}),
),
);
}
return const MaterialApp(
home: Scaffold(
body: Center(
child: SizedBox(
height: 60,
width: 60,
child: CircularProgressIndicator(
strokeWidth: 6,
),
),
)),
);
},
);
}
}
================================================
FILE: lib/models/routine.dart
================================================
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:intl/intl.dart';
import 'package:koduko/models/task.dart';
import 'package:koduko/models/task_event.dart';
import 'package:koduko/utils/date_time_extension.dart';
import 'package:koduko/utils/parse_duration.dart';
import 'package:koduko/utils/time_of_day_util.dart';
import 'package:uuid/uuid.dart';
part 'routine.g.dart';
@HiveType(typeId: 2)
class Routine {
@HiveField(0)
late final String id;
@HiveField(1)
String name;
@HiveField(2)
List tasks;
@HiveField(3)
late List inCompletedTasks;
@HiveField(4)
late List history;
@HiveField(5, defaultValue: true)
late bool isCompleted;
@HiveField(6)
List days;
@HiveField(7, defaultValue: null)
DateTime? time;
@HiveField(8, defaultValue: false)
late bool isArchive;
Routine({
required this.name,
required this.tasks,
required this.inCompletedTasks,
required this.history,
required this.id,
required this.days,
required this.isCompleted,
required this.time,
required this.isArchive,
bool isSkip = false,
}) {
if (isSkip) {
return;
}
if (inCompletedTasks.isNotEmpty || isCompleted) {
if (history.isNotEmpty) {
bool isNewDay = true;
for (var element in history) {
if (element.time.isSameDate(DateTime.now())) {
isNewDay = false;
break;
}
}
if (isNewDay) {
isCompleted = false;
inCompletedTasks = [];
}
}
}
if (inCompletedTasks.isEmpty && !isCompleted) {
inCompletedTasks = tasks;
}
}
Routine.create({
required this.name,
required this.tasks,
required this.days,
required this.time,
// List? inCompletedTasks,
}) {
id = const Uuid().v4();
isCompleted = false;
history = [];
tasks = tasks;
inCompletedTasks = tasks;
isArchive = false;
}
Routine copyWith({
List? tasks,
List? inCompletedTasks,
List? history,
String? id,
String? name,
List? days,
bool? isCompleted,
TimeOfDay? time,
bool isSkip = false,
bool? isArchive,
}) {
return Routine(
name: name ?? this.name,
tasks: tasks ?? this.tasks,
inCompletedTasks: inCompletedTasks ?? this.inCompletedTasks,
history: history ?? this.history,
id: id ?? this.id,
days: days ?? this.days,
isCompleted: isCompleted ?? this.isCompleted,
time: timeOfDayToDateTime(time) ?? this.time,
isSkip: isSkip,
isArchive: isArchive ?? this.isArchive);
}
Routine skipTask() {
List r = List.from(inCompletedTasks);
Task t = r.removeAt(0);
r.add(t);
final g = copyWith(inCompletedTasks: r, isSkip: true);
return g;
}
Routine completeTask() {
List r = List.from(inCompletedTasks);
var t = r.removeAt(0);
List h = List.from(history);
h.add(
TaskEvent.create(taskName: t.name, taskId: t.id, time: DateTime.now()));
h.sort((a, b) => b.time.compareTo(a.time));
return copyWith(
inCompletedTasks: r, isCompleted: r.isEmpty ? true : false, history: h);
}
Routine replay() {
return copyWith(isCompleted: false);
}
int getCompletedTasks(DateTime d) {
var count = 0;
if (history.isEmpty) {
return count;
} else {
for (var element in history) {
if (element.time.isSameDate(d)) {
count++;
}
}
}
return count;
}
Duration getTotalTime() {
Duration d = Duration.zero;
for (var t in tasks) {
d = parseDuration(t.duration) + d;
}
return d;
}
Duration getTimeSpentToday() {
Duration d = getTotalTime() - getTimeLeft();
return d;
}
Duration getTimeLeft() {
Duration d = Duration.zero;
for (var t in inCompletedTasks) {
d = d + parseDuration(t.duration);
}
return d;
}
Routine addToArchive() {
return copyWith(isArchive: true);
}
Routine removeFromArchive() {
return copyWith(isArchive: false);
}
Routine? removeHistory(String id) {
List h = List.from(history);
final index = h.indexWhere((element) => element.id == id);
if (index > -1) {
h.removeAt(index);
return copyWith(history: h);
}
return null;
}
Routine clearHistory() {
return copyWith(history: [], isCompleted: false);
}
Routine markAsCompleted() {
List h = List.from(history);
for (var i = 0; i < inCompletedTasks.length; i++) {
final task = inCompletedTasks[i];
h.add(TaskEvent.create(
taskName: task.name,
taskId: task.id,
time: DateTime.now().add(Duration(seconds: i)),
));
}
h.sort((a, b) => b.time.compareTo(a.time));
return copyWith(isCompleted: true, inCompletedTasks: [], history: h);
}
Routine markAsInCompleted() {
List h = List.from(history);
for (var task in tasks) {
final i = h.indexWhere((element) => element.taskId == task.id);
if (i > -1) {
h.removeAt(i);
}
}
h.sort((a, b) => b.time.compareTo(a.time));
return copyWith(isCompleted: false, inCompletedTasks: tasks, history: h);
}
Routine? taskExists(Task t) {
int index = tasks.indexWhere((element) => element.id.compareTo(t.id) == 0);
if (index > -1) {
List ts = List.from(tasks);
ts.removeAt(index);
return copyWith(tasks: ts);
}
return null;
}
Routine? editTasks(Task t) {
if (tasks.isNotEmpty) {
List tep = [];
List temp = tasks.map((e) => e.id == t.id ? t : e).toList();
if (inCompletedTasks.isNotEmpty) {
tep = inCompletedTasks.map((e) => e.id == t.id ? t : e).toList();
}
return copyWith(tasks: temp, inCompletedTasks: tep);
}
return null;
}
String getDays() {
return days.length == 7
? "Daily"
: days.map((e) => e.substring(0, 3)).join(", ");
}
static List taskDiff(List first, List second) {
var a = [...first];
var b = [...second];
if (a.length > b.length) {
for (int i = 0; i < b.length; i++) {
int index = a.indexWhere((t) => t.id == b[i].id);
if (index > -1) {
a.removeAt(index);
}
}
return a;
} else {
for (int i = 0; i < a.length; i++) {
int index = b.indexWhere((t) => t.id == a[i].id);
if (index > -1) {
b.removeAt(index);
}
}
return b;
}
}
bool isToday() {
return days.contains(DateFormat("EEEE").format(DateTime.now()));
}
double getPercentage() {
return (tasks.length - inCompletedTasks.length) == 0
? 0
: ((tasks.length - inCompletedTasks.length) / tasks.length);
}
String getPercentageString() {
return '${(getPercentage() * 100).toInt()}%';
}
}
================================================
FILE: lib/models/routine.g.dart
================================================
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'routine.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class RoutineAdapter extends TypeAdapter {
@override
final int typeId = 2;
@override
Routine read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return Routine(
name: fields[1] as String,
tasks: (fields[2] as List).cast(),
inCompletedTasks: (fields[3] as List).cast(),
history: (fields[4] as List).cast(),
id: fields[0] as String,
days: (fields[6] as List).cast(),
isCompleted: fields[5] == null ? true : fields[5] as bool,
time: fields[7] as DateTime?,
isArchive: fields[8] == null ? false : fields[8] as bool,
);
}
@override
void write(BinaryWriter writer, Routine obj) {
writer
..writeByte(9)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.name)
..writeByte(2)
..write(obj.tasks)
..writeByte(3)
..write(obj.inCompletedTasks)
..writeByte(4)
..write(obj.history)
..writeByte(5)
..write(obj.isCompleted)
..writeByte(6)
..write(obj.days)
..writeByte(7)
..write(obj.time)
..writeByte(8)
..write(obj.isArchive);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RoutineAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
================================================
FILE: lib/models/task.dart
================================================
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:uuid/uuid.dart';
part 'task.g.dart';
@HiveType(typeId: 1)
class Task {
@HiveField(0)
late String id;
@HiveField(1)
String name;
@HiveField(2)
late String duration;
@HiveField(3)
late int color;
Task(
{required this.duration,
required this.name,
required this.color,
required this.id});
Task copyWith({
String? duration,
String? name,
int? color,
String? id,
}) {
return Task(
duration: duration ?? this.duration,
name: name ?? this.name,
color: color ?? this.color,
id: id ?? this.id);
}
Task.fromDuration(
{required Duration duration, required this.name, required Color color}) {
this.duration = duration.toString();
this.color = color.value;
id = const Uuid().v4();
}
@override
String toString() {
super.toString();
return '{id: $id ,name: $name, color: $color, duration: $duration}';
}
}
================================================
FILE: lib/models/task.g.dart
================================================
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'task.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class TaskAdapter extends TypeAdapter {
@override
final int typeId = 1;
@override
Task read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return Task(
duration: fields[2] as String,
name: fields[1] as String,
color: fields[3] as int,
id: fields[0] as String,
);
}
@override
void write(BinaryWriter writer, Task obj) {
writer
..writeByte(4)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.name)
..writeByte(2)
..write(obj.duration)
..writeByte(3)
..write(obj.color);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is TaskAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
================================================
FILE: lib/models/task_event.dart
================================================
import 'package:hive_flutter/adapters.dart';
import 'package:uuid/uuid.dart';
part 'task_event.g.dart';
@HiveType(typeId: 3)
class TaskEvent {
@HiveField(0)
late final String id;
@HiveField(1)
final String taskName;
@HiveField(2)
final DateTime time;
@HiveField(3)
final String taskId;
TaskEvent({
required this.id,
required this.taskName,
required this.time,
required this.taskId,
});
@override
String toString() {
return '[Id : $id, Name: $taskName, Time: $time, TaskId: $taskId]';
}
TaskEvent.create({
required this.taskName,
required this.taskId,
required this.time,
}) {
id = const Uuid().v4();
}
}
================================================
FILE: lib/models/task_event.g.dart
================================================
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'task_event.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class TaskEventAdapter extends TypeAdapter {
@override
final int typeId = 3;
@override
TaskEvent read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return TaskEvent(
id: fields[0] as String,
taskName: fields[1] as String,
time: fields[2] as DateTime,
taskId: fields[3] as String,
);
}
@override
void write(BinaryWriter writer, TaskEvent obj) {
writer
..writeByte(4)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.taskName)
..writeByte(2)
..write(obj.time)
..writeByte(3)
..write(obj.taskId);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is TaskEventAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
================================================
FILE: lib/screens/about.dart
================================================
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:koduko/components/header.dart';
import 'package:url_launcher/url_launcher.dart';
class AboutScreen extends StatelessWidget {
const AboutScreen({super.key});
static const routeName = "/about";
@override
Widget build(BuildContext context) {
Future openUrl(url) async {
if (!await launchUrl(url, mode: LaunchMode.externalApplication)) {
throw 'Could not launch $url';
}
}
return Scaffold(
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 25),
const ScreenHeader(
text: "About",
tag: "About",
),
const SizedBox(height: 25),
Padding(
padding: const EdgeInsets.all(15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
text: TextSpan(
text:
"Koduko is an open source habit tracker app that helps users develop and maintain positive daily habits. Users can set personalized goals and track their progress towards achieving them, as well as receive reminders to stay on track. You can find the source code and releases ",
style: Theme.of(context).textTheme.bodyLarge,
children: [
TextSpan(
text: "here",
recognizer: TapGestureRecognizer()
..onTap = () => openUrl(Uri.parse(
'https://github.com/Mazahir26/koduko')),
style: Theme.of(context)
.textTheme
.bodyLarge!
.copyWith(
color:
Theme.of(context).colorScheme.primary,
),
)
]),
),
const SizedBox(height: 15),
Text(
'Developer Contact',
style: Theme.of(context)
.textTheme
.headlineMedium!
.copyWith(fontWeight: FontWeight.bold),
),
const SizedBox(height: 10),
Text(
"For any questions or suggestions regarding Koduko's functionality or code, You can reach me out via telegram or github",
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextButton(
onPressed: () {
openUrl(
Uri.parse('https://github.com/Mazahir26'));
},
child: const Text("GitHub")),
TextButton(
onPressed: () {
openUrl(Uri.parse('https://t.me/mazahir26'));
},
child: const Text("Telegram"))
],
),
const SizedBox(height: 30),
Center(
child: Text(
"Thank You ❤️",
style: Theme.of(context)
.textTheme
.headlineMedium!
.copyWith(fontWeight: FontWeight.bold),
),
),
],
),
)
],
),
),
),
);
}
}
================================================
FILE: lib/screens/app.dart
================================================
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:koduko/screens/home.dart';
import 'package:koduko/screens/routines.dart';
import 'package:koduko/screens/settings.dart';
import 'package:koduko/screens/start_routine.dart';
import 'package:koduko/screens/tasks.dart';
import 'package:koduko/services/notification_service.dart';
class App extends StatefulWidget {
const App({super.key});
static const routeName = "/";
@override
State createState() => _AppState();
}
class _AppState extends State {
int _selectedIndex = 0;
late final NotificationService service;
late final StreamSubscription stream;
NotificationAppLaunchDetails? notificationAppLaunchDetails;
late final PageController _pageController;
getDeviceLaunch() async {
notificationAppLaunchDetails = await service.getDeviceLaunchInfo();
if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) {
if ((notificationAppLaunchDetails!
.notificationResponse?.payload?.isNotEmpty ??
false)) {
onNotificationListener(
notificationAppLaunchDetails!.notificationResponse?.payload);
}
}
}
void _onItemTapped(int index) {
setState(() {
_pageController.animateToPage(
index,
duration: const Duration(milliseconds: 250),
curve: Curves.easeInOutCirc,
);
_selectedIndex = index;
});
}
@override
void initState() {
service = NotificationService();
getDeviceLaunch();
_pageController = PageController();
stream = service.onNotificationClick.stream.listen(onNotificationListener);
super.initState();
}
@override
void dispose() {
stream.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
final List widgetOptions = [
HomeScreen(
onTapChange: () => _onItemTapped(1),
),
const RoutinesScreen(),
const TasksScreen(isBottomNavWidget: true),
const SettingsScreen(),
];
return AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor:
Theme.of(context).brightness == Brightness.dark
? Colors.black
: Colors.white,
statusBarIconBrightness: Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark,
systemNavigationBarIconBrightness:
Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark,
),
child: Scaffold(
bottomNavigationBar: NavigationBar(
onDestinationSelected: _onItemTapped,
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
selectedIndex: _selectedIndex,
destinations: const [
NavigationDestination(
selectedIcon: Icon(Icons.home_rounded),
icon: Icon(Icons.home_outlined),
label: 'Home',
),
NavigationDestination(
selectedIcon: Icon(Icons.task_alt_rounded),
icon: Icon(Icons.task_alt_outlined),
label: 'Routines',
),
NavigationDestination(
selectedIcon: Icon(Icons.list_rounded),
icon: Icon(Icons.list_outlined),
label: 'Tasks',
),
NavigationDestination(
selectedIcon: Icon(Icons.settings_rounded),
icon: Icon(Icons.settings_outlined),
label: 'Settings',
),
],
),
body: SafeArea(
child: PageView(
controller: _pageController,
onPageChanged: (value) => setState(() {
_selectedIndex = value;
}),
children: widgetOptions,
),
),
),
);
}
void onNotificationListener(String? payload) {
if (payload != null && payload.isNotEmpty) {
Navigator.push(
context,
MaterialPageRoute(
builder: ((context) => RoutineScreen(
routine: payload,
))));
}
}
}
================================================
FILE: lib/screens/archive_routines.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:koduko/components/header.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:provider/provider.dart';
class ArchiveRoutinesScreen extends StatelessWidget {
const ArchiveRoutinesScreen({super.key});
static const routeName = "/archive";
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Consumer(
builder: (context, value, child) => value.archiveRoutines().isEmpty
? Padding(
padding:
const EdgeInsets.symmetric(vertical: 20, horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
child ?? Container(),
Expanded(
flex: 10,
child: Center(
child: Text(
"Archived routines will show up here!",
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.apply(
displayColor:
Theme.of(context).colorScheme.onSurface)
.headlineMedium,
),
),
),
],
),
)
: ListView.builder(
itemCount: value.archiveRoutines().length + 1,
itemBuilder: (context, index) {
if (index == 0) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 20, horizontal: 10),
child: child ?? Container(),
);
}
index -= 1;
return Card(
margin: const EdgeInsets.all(10),
child: ListTile(
title: Text(
value.archiveRoutines()[index].name,
style: Theme.of(context).textTheme.titleLarge,
),
subtitle: const Text("Archived"),
trailing: SizedBox(
width: 100,
child: Row(
children: [
IconButton(
color: Colors.brown[300],
onPressed: () {
Provider.of(context,
listen: false)
.removeFromArchive(
value.archiveRoutines()[index].id);
},
icon: const Icon(Icons.unarchive_rounded),
),
IconButton(
color: Colors.red[300],
onPressed: () {},
icon: const Icon(Icons.delete),
)
],
),
),
),
);
}),
child: const ScreenHeader(text: 'Archived', tag: 'Archived'),
),
),
);
}
}
class Action extends StatelessWidget {
const Action(
{super.key,
required this.onPress,
required this.color,
required this.icon,
required this.label});
final Function(BuildContext context) onPress;
final Color color;
final IconData icon;
final String label;
@override
Widget build(BuildContext context) {
return Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Center(
child: TextButton.icon(
onPressed: (() {
onPress(context);
Slidable.of(context)?.close();
}),
icon: Icon(
icon,
color: color,
),
label: Text(
label,
style: Theme.of(context).textTheme.titleMedium!.apply(color: color),
),
)),
),
);
}
}
================================================
FILE: lib/screens/home.dart
================================================
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:koduko/components/weekly_chart.dart';
import 'package:koduko/models/routine.dart';
import 'package:koduko/screens/start_routine.dart';
import 'package:koduko/screens/stats.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:koduko/utils/greetings.dart';
import 'package:percent_indicator/percent_indicator.dart';
import 'package:provider/provider.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key, required this.onTapChange});
final void Function() onTapChange;
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context)
.textTheme
.apply(displayColor: Theme.of(context).colorScheme.onSurface);
return ListView(
padding: const EdgeInsets.all(15),
children: [
const SizedBox(height: 20),
Header(textTheme: textTheme),
const SizedBox(height: 20),
Hero(
tag: 'WeeklyChart',
child: WeeklyChart(textTheme: textTheme),
),
Align(
alignment: Alignment.centerRight,
child: TextButton.icon(
onPressed: () => Navigator.pushNamed(context, Statistics.routeName),
icon: const Text("More Stats"),
label: const Icon(Icons.chevron_right_rounded),
),
),
Text("Today's Routines",
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: textTheme.headlineMedium,
)),
Consumer(
builder: (context, value, child) {
List todayRoutines = value.todaysRoutines();
final Duration totalTime = value.todaysRoutines().fold(
Duration.zero,
(previousValue, element) =>
previousValue + element.getTimeLeft());
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${totalTime.inMinutes} mins left to reach your goal today ",
style: GoogleFonts.lato(
fontWeight: FontWeight.w400,
textStyle: Theme.of(context)
.textTheme
.apply(
displayColor:
Theme.of(context).colorScheme.onSurface)
.bodyLarge,
),
),
const SizedBox(height: 10),
Column(
children: todayRoutines.isEmpty
? [
const SizedBox(
height: 50,
),
Center(
child: Text(
"You seem free today!",
style: Theme.of(context).textTheme.headlineSmall,
),
),
Center(
child: TextButton(
style: TextButton.styleFrom(
textStyle:
Theme.of(context).textTheme.titleMedium),
onPressed: onTapChange,
child: const Text(
"Change that?",
),
),
)
]
: todayRoutines
.asMap()
.map((key, value) => MapEntry(
key,
Row(
children: [
Expanded(
flex: 1,
child: Text(
'${key + 1}',
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: textTheme.headlineLarge,
),
),
),
Expanded(
flex: 10,
child: Card(
margin: const EdgeInsets.symmetric(
vertical: 5,
),
child: ListTile(
title: Text(
value.name,
style: Theme.of(context)
.textTheme
.titleLarge,
),
subtitle: Padding(
padding: const EdgeInsets.symmetric(
vertical: 3),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
value.inCompletedTasks.isEmpty
? const Text("Completed")
: Text(
'Completed ${value.tasks.length - value.inCompletedTasks.length} out of ${value.tasks.length}'),
const SizedBox(height: 5),
LinearPercentIndicator(
animateFromLastPercent: true,
animation: true,
percent: value
.getPercentage()
.clamp(0, 1),
barRadius:
const Radius.circular(10),
lineHeight: 3,
progressColor:
Theme.of(context)
.colorScheme
.inversePrimary,
padding: EdgeInsets.zero,
),
],
),
),
trailing: IconButton(
padding: EdgeInsets.zero,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: ((context) =>
RoutineScreen(
routine: value.id,
))));
},
icon: Icon(
value.isCompleted
? Icons.replay_rounded
: Icons.play_arrow_rounded,
size: 30,
))),
),
),
],
)))
.values
.toList(),
),
],
);
},
)
],
);
}
}
class Header extends StatelessWidget {
const Header({
super.key,
required this.textTheme,
});
final TextTheme textTheme;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Good ${greeting()} 👋',
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: textTheme.headlineLarge,
),
),
Text(
DateFormat.MMMMEEEEd().format(DateTime.now()),
style: GoogleFonts.lato(
fontWeight: FontWeight.w400,
textStyle: Theme.of(context).textTheme.titleLarge!.apply(
color:
Theme.of(context).colorScheme.onSurface.withOpacity(0.5)),
),
),
],
);
}
}
================================================
FILE: lib/screens/onboarding.dart
================================================
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hive_flutter/adapters.dart';
class OnBoarding extends StatefulWidget {
const OnBoarding({super.key});
static const routeName = "/onBoarding";
@override
State createState() => _OnBoardingState();
}
class _OnBoardingState extends State {
int _index = 0;
late final PageController _pageController;
final okColors = [
const Color.fromRGBO(251, 187, 91, 1),
const Color.fromRGBO(44, 155, 243, 1),
const Color.fromRGBO(67, 60, 85, 1),
];
@override
void initState() {
_pageController = PageController();
super.initState();
}
@override
void dispose() {
_pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return TweenAnimationBuilder(
tween: ColorTween(
begin: const Color.fromRGBO(251, 187, 91, 1), end: okColors[_index]),
duration: const Duration(milliseconds: 250),
builder: (context, value, child) => Scaffold(
backgroundColor: value,
body: SafeArea(
child: Container(
color: value,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
flex: 10,
child: PageView(
controller: _pageController,
onPageChanged: (value) => setState(() {
_index = value;
}),
children: [
Page(
color: value,
title: "Koduko",
imagePath: 'assets/onboarding/person.png',
des:
"Hey There! Yes, this is an habit tracker don't let the name fool you. It will help you manage your daily or weekly habits with ease.",
),
Page(
color: value,
title: "You ask features?",
imagePath: 'assets/onboarding/gymTime.png',
des:
"It has a lot of them. You add a routine which can contain multiple tasks, Select a time and you are done. It will remind you at the specified time. Also there are statistics ",
),
Page(
color: value,
title: "Ready?",
imagePath: 'assets/onboarding/watch.png',
des: "We hope you are! \n Have fun.",
),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Buttons(
onSkip: () {
setState(() {
_index = 2;
});
_pageController.animateToPage(2,
curve: Curves.easeIn,
duration: const Duration(milliseconds: 250));
},
pageIndex: _index,
onNext: () {
if (_index == 2) {
final box = Hive.box('Theme');
if (box.isOpen) {
box.put('isNewUser', false);
}
Navigator.pushReplacementNamed(context, '/');
}
if (_index > 1) {
return;
}
setState(() {
_index++;
});
_pageController.nextPage(
duration: const Duration(milliseconds: 250),
curve: Curves.easeIn,
);
},
onPrevious: () {
if (_index <= 0) {
return;
}
setState(() {
_index--;
});
_pageController.previousPage(
duration: const Duration(milliseconds: 250),
curve: Curves.easeIn,
);
},
text: _index == 2 ? 'Start' : null,
color: value,
),
)),
const SizedBox(height: 10)
],
),
),
),
),
);
}
}
class Page extends StatelessWidget {
const Page({
super.key,
required this.imagePath,
required this.title,
required this.des,
required this.color,
});
final String imagePath;
final String title;
final String des;
final Color? color;
@override
Widget build(BuildContext context) {
return Column(
children: [
Image(image: AssetImage(imagePath)),
Text(
title,
style: GoogleFonts.catamaran(
fontWeight: FontWeight.bold,
textStyle: Theme.of(context).textTheme.headlineLarge!.apply(
color: (color?.computeLuminance() ?? 0.1) > 0.5
? Colors.black
: Colors.white)),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
des,
style: GoogleFonts.raleway(
textStyle: Theme.of(context).textTheme.titleMedium!.apply(
color: (color?.computeLuminance() ?? 0.1) > 0.5
? Colors.black
: Colors.white)),
textAlign: TextAlign.center,
),
)
],
);
}
}
class Buttons extends StatelessWidget {
const Buttons({
super.key,
required this.pageIndex,
required this.onNext,
required this.onPrevious,
required this.onSkip,
required this.text,
this.color,
});
final Color? color;
final int pageIndex;
final void Function() onNext;
final void Function() onPrevious;
final void Function() onSkip;
final String? text;
@override
Widget build(BuildContext context) {
final Color textColor =
(color?.computeLuminance() ?? 0.1) > 0.5 ? Colors.black : Colors.white;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AnimatedCrossFade(
alignment: Alignment.center,
firstChild: TextButton.icon(
icon: const Icon(Icons.chevron_left_rounded),
style: TextButton.styleFrom(
foregroundColor: textColor,
),
label: Text(
'Back',
style: Theme.of(context).textTheme.titleSmall!.apply(
color: textColor,
),
),
onPressed: onPrevious,
),
secondChild: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey[900],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
)),
onPressed: onSkip,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
'Skip',
style: Theme.of(context).textTheme.titleSmall!.apply(
color: Colors.white,
),
),
),
),
crossFadeState: pageIndex == 0
? CrossFadeState.showSecond
: CrossFadeState.showFirst,
duration: const Duration(milliseconds: 250)),
AnimatedCrossFade(
alignment: Alignment.center,
firstChild: TextButton.icon(
label: text == null
? const Icon(Icons.chevron_right_rounded)
: Container(),
style: TextButton.styleFrom(
foregroundColor: textColor,
),
icon: Text(
'Next',
style: Theme.of(context).textTheme.titleSmall!.apply(
color: textColor,
),
),
onPressed: onNext,
),
secondChild: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
),
onPressed: onNext,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
child: Text(
text ?? 'Done',
style: Theme.of(context).textTheme.titleSmall!.apply(
color: Colors.grey[900],
),
),
),
),
crossFadeState: text == null
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
duration: const Duration(milliseconds: 250),
),
],
),
);
}
}
================================================
FILE: lib/screens/routines.dart
================================================
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:koduko/components/create_routine_bottom_sheet.dart';
import 'package:koduko/components/routine_tile.dart';
import 'package:koduko/models/routine.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:provider/provider.dart';
class RoutinesScreen extends StatelessWidget {
const RoutinesScreen({super.key});
@override
Widget build(BuildContext context) {
void addRoutine(Routine r) {
Provider.of(context, listen: false).add(r);
}
void editRoutine(Routine r) {
Provider.of(context, listen: false).edit(r);
}
return Scaffold(
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () async {
Routine? r = await showModalBottomSheet(
isScrollControlled: true,
isDismissible: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(10),
bottom: Radius.zero,
),
),
context: context,
builder: ((context) => const CreateRoutineBottomSheet()));
if (r != null) {
addRoutine(r);
}
},
),
body: Consumer(
builder: ((context, value, child) {
final Duration totalTime = value.todaysRoutines().fold(
Duration.zero,
(previousValue, element) =>
previousValue + element.getTimeLeft());
return value.todaysRoutines().isEmpty && value.allRoutines().isEmpty
? Padding(
padding: const EdgeInsets.all(15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 20),
Expanded(
flex: 1,
child: Text(
"Routines",
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: Theme.of(context)
.textTheme
.apply(
displayColor:
Theme.of(context).colorScheme.onSurface)
.headlineLarge,
),
),
),
const SizedBox(height: 30),
Expanded(
flex: 10,
child: Center(
child: Text(
"Looks Empty! \n Try to add a routine",
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.apply(
displayColor:
Theme.of(context).colorScheme.onSurface)
.headlineMedium,
),
),
),
],
),
)
: ListView(
children: [
value.todaysRoutines().isEmpty
? Container()
: Padding(
padding: const EdgeInsets.all(15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 20),
Text(
"Today's Routines",
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: Theme.of(context)
.textTheme
.apply(
displayColor: Theme.of(context)
.colorScheme
.onSurface)
.headlineMedium,
),
),
Text(
"${totalTime.inMinutes} mins left to reach your goal today ",
style: GoogleFonts.lato(
fontWeight: FontWeight.w400,
textStyle: Theme.of(context)
.textTheme
.apply(
displayColor: Theme.of(context)
.colorScheme
.onSurface)
.bodyLarge,
),
),
const SizedBox(height: 20),
...value
.todaysRoutines()
.map((e) => RoutineTile(
routine: e,
isToday: true,
onEdit: editRoutine,
))
]),
),
value.allRoutines().isEmpty
? Container()
: Padding(
padding: const EdgeInsets.all(15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
value.routines
.where(
(element) => element.days.contains(
DateFormat('EEEE')
.format(DateTime.now()),
),
)
.isEmpty
? const SizedBox(height: 20)
: Container(),
Text(
"All Routines",
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: Theme.of(context)
.textTheme
.apply(
displayColor: Theme.of(context)
.colorScheme
.onSurface)
.headlineMedium),
),
const SizedBox(height: 20),
...value
.allRoutines()
.map((e) => RoutineTile(
routine: e,
onEdit: editRoutine,
))
]),
)
],
);
}),
),
);
}
}
================================================
FILE: lib/screens/settings.dart
================================================
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:koduko/screens/about.dart';
import 'package:koduko/screens/archive_routines.dart';
import 'package:koduko/screens/stats.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:koduko/services/theme_provider.dart';
import 'package:provider/provider.dart';
class SettingsScreen extends StatelessWidget {
const SettingsScreen({super.key});
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context)
.textTheme
.apply(displayColor: Theme.of(context).colorScheme.onSurface);
return Padding(
padding: const EdgeInsets.all(15),
child: ListView(
children: [
const SizedBox(height: 20),
Text(
"Settings",
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: textTheme.headlineLarge,
),
),
const SizedBox(height: 30),
Card(
margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 8),
child: InkWell(
onTap: () =>
Navigator.pushNamed(context, ArchiveRoutinesScreen.routeName),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Hero(
tag: "Archived",
child: Text(
"Archived",
style: textTheme.titleLarge,
),
),
IconButton(
onPressed: () => Navigator.pushNamed(
context, ArchiveRoutinesScreen.routeName),
icon: const Icon(Icons.chevron_right_rounded)),
],
),
),
),
),
Card(
margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 8),
child: InkWell(
onTap: () => Navigator.pushNamed(context, Statistics.routeName),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Hero(
tag: "Statistics",
child: Text(
"Statistics",
style: textTheme.titleLarge,
),
),
IconButton(
onPressed: () =>
Navigator.pushNamed(context, Statistics.routeName),
icon: const Icon(Icons.chevron_right_rounded)),
],
),
),
),
),
Card(
margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 8),
child: InkWell(
onTap: () {
Provider.of(context, listen: false).toggleTheme();
},
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Dark Mode",
style: textTheme.titleLarge,
),
Consumer(
builder: (context, value, child) => TextButton.icon(
label: value.getTheme == ThemeMode.system
? const Text("System")
: value.getTheme == ThemeMode.dark
? const Text("Dark")
: const Text("Light"),
onPressed: () {
Provider.of(context, listen: false)
.toggleTheme();
},
icon: value.getTheme == ThemeMode.system
? const Icon(Icons.settings)
: value.getTheme == ThemeMode.dark
? const Icon(Icons.dark_mode_rounded)
: const Icon(Icons.light_mode_rounded)),
)
],
),
),
),
),
Card(
margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 8),
child: InkWell(
onTap: () {
Provider.of(context, listen: false)
.toggleNotifications();
},
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Notifications ",
style: textTheme.titleLarge,
),
Selector(
selector: (p0, p1) => p1.notifications,
builder: (context, value, child) => TextButton.icon(
label: value ? const Text("ON") : const Text("OFF"),
onPressed: () {
Provider.of(context, listen: false)
.toggleNotifications();
},
icon: value
? const Icon(Icons.notifications_active_rounded)
: const Icon(Icons.notifications_off_rounded),
),
)
],
),
),
),
),
Card(
margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 8),
child: InkWell(
onTap: () => Navigator.pushNamed(context, AboutScreen.routeName),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"About ",
style: textTheme.titleLarge,
),
IconButton(
onPressed: () =>
Navigator.pushNamed(context, AboutScreen.routeName),
icon: const Icon(Icons.person)),
],
),
),
),
),
const SizedBox(height: 25),
Center(
child: Text(
"Version: 1.0.2",
style: textTheme.labelMedium!
.apply(color: textTheme.labelMedium!.color!.withOpacity(0.5)),
),
),
const SizedBox(height: 5),
Center(
child: Text(
"Made in India with ❤️",
style: textTheme.labelMedium!
.apply(color: textTheme.labelMedium!.color!.withOpacity(0.5)),
),
),
const SizedBox(height: 20),
],
),
);
}
}
================================================
FILE: lib/screens/start_routine.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:koduko/components/card.dart';
import 'package:koduko/models/task.dart';
import 'package:koduko/services/notification_service.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:koduko/services/theme_provider.dart';
import 'package:koduko/utils/colors_util.dart';
import 'package:koduko/utils/parse_duration.dart';
import 'package:provider/provider.dart';
class RoutineScreen extends StatefulWidget {
final String routine;
const RoutineScreen({super.key, required this.routine});
@override
State createState() => RoutineScreenState();
}
class RoutineScreenState extends State
with TickerProviderStateMixin {
late final AnimationController _controller;
late final AnimationController _buttonController;
bool _isPlaying = false;
bool _isComplete = false;
bool _isSkipped = false;
DateTime _playedOn = DateTime.now();
@override
void initState() {
_controller =
AnimationController(vsync: this, duration: const Duration(minutes: 1));
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
var routine = Provider.of(context, listen: false)
.getRoutine(widget.routine);
if (routine == null) {
return;
}
if (routine.isCompleted) {
Provider.of(context, listen: false).replay(routine.id);
_controller.duration = parseDuration(
Provider.of(context, listen: false)
.getRoutine(routine.id)!
.tasks
.first
.duration,
);
} else {
_controller.duration = parseDuration(
Provider.of(context, listen: false)
.getRoutine(routine.id)!
.inCompletedTasks
.first
.duration,
);
}
setState(() {
_isPlaying = false;
});
});
_buttonController = AnimationController(
vsync: this, duration: const Duration(milliseconds: 250));
_controller.addListener(() {
if (_controller.status == AnimationStatus.forward) {
final diff = DateTime.now().difference(_playedOn);
//Check if the difference is more that 100 milliseconds
if ((diff - (_controller.duration! * _controller.value))
.abs()
.inMilliseconds >
100) {
_controller.forward(
from: (diff.inMilliseconds / _controller.duration!.inMilliseconds)
.clamp(0, 1));
}
}
});
_controller.addStatusListener((status) {
if (status == AnimationStatus.completed) {
NotificationService().cancelNotificationWithId(777);
setState(() {
_isComplete = true;
});
}
});
super.initState();
}
void onTap(TapUpDetails? _) async {
final task = Provider.of(context, listen: false)
.getRoutine(widget.routine)!
.inCompletedTasks
.first;
if (_isPlaying) {
setState(() {
_isPlaying = false;
});
NotificationService().cancelNotification(task.id + widget.routine);
_controller.stop();
_buttonController.reverse();
} else {
Duration d = (_controller.duration! * _controller.value);
setState(() {
_playedOn = DateTime.now().subtract(d);
_isPlaying = true;
});
NotificationService().scheduledNotification((_controller.duration! - d),
task.id + widget.routine, task.name, 'Completed!');
_controller.forward();
_buttonController.forward();
}
}
void onDismiss(DismissDirection t, BuildContext context) {
final task = Provider.of(context, listen: false)
.getRoutine(widget.routine)!
.inCompletedTasks
.first;
NotificationService().cancelNotification(task.id + widget.routine);
if (t == DismissDirection.endToStart) {
Provider.of(context, listen: false)
.skipTask(widget.routine);
setState(() {
_controller.reset();
if (_isSkipped) {
_isSkipped = false;
if (_isPlaying) {
_isPlaying = false;
_buttonController.reverse();
}
}
});
var ts = Provider.of(context, listen: false)
.getRoutine(widget.routine)!
.inCompletedTasks;
if (ts.isNotEmpty) {
_controller.duration = parseDuration(ts.first.duration);
}
} else if (t == DismissDirection.startToEnd) {
Provider.of(context, listen: false)
.completeTask(widget.routine);
_controller.reset();
setState(() {
if (_isPlaying) {
_isPlaying = false;
_buttonController.reverse();
}
if (_isComplete) {
_isComplete = false;
_playedOn = DateTime.now();
}
});
var ts = Provider.of(context, listen: false)
.getRoutine(widget.routine)!
.inCompletedTasks;
if (ts.isNotEmpty) {
_controller.duration = parseDuration(ts.first.duration);
}
}
}
@override
void dispose() {
NotificationService().cancelNotificationWithId(777);
_controller.dispose();
_buttonController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor:
Theme.of(context).brightness == Brightness.dark
? Colors.black
: Colors.white,
statusBarIconBrightness: Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark,
systemNavigationBarIconBrightness:
Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark,
),
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: IconButton(
onPressed: () {
if (Provider.of(context, listen: false)
.getRoutine(widget.routine)!
.inCompletedTasks
.isNotEmpty) {
final task = Provider.of(context, listen: false)
.getRoutine(widget.routine)!
.inCompletedTasks
.first;
NotificationService()
.cancelNotification(task.id + widget.routine);
}
Navigator.pop(context);
},
icon: const Icon(
Icons.arrow_back_ios,
size: 30,
),
),
),
title: Selector(
selector: (p0, p1) => p1.getRoutine(widget.routine)!.name,
builder: (context, value, child) => Hero(
tag: value,
child: Text(
value,
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: Theme.of(context)
.textTheme
.apply(
displayColor: Theme.of(context).colorScheme.onSurface)
.headlineLarge,
),
textAlign: TextAlign.center,
),
),
),
),
body: Padding(
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10),
child: Selector>(
selector: (p0, p1) =>
p1.getRoutine(widget.routine)!.inCompletedTasks,
builder: ((context, value, child) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
flex: 7,
child: Stack(
alignment: AlignmentDirectional.center,
children: [
SizedBox(
height: 300,
child: Center(
child: Text("Good Work",
style: GoogleFonts.lato(
fontWeight: FontWeight.bold,
textStyle: Theme.of(context)
.textTheme
.displayMedium!
.apply(
color: Theme.of(context)
.textTheme
.bodyMedium!
.color),
)),
),
),
...value
.asMap()
.entries
.map(
(e) => Consumer(
builder: (context, themeData, child) {
bool isSwipeDis = false;
if (e.key == 0) {
int count = 0;
for (var element in value) {
if (element.id == e.value.id) {
count++;
}
}
if (count == value.length) {
isSwipeDis = true;
}
}
return TaskCard(
isSwipeDisabled:
value.length == 1 || isSwipeDis,
isSkipped: _isSkipped,
isCompleted: _isComplete,
buttonController: _buttonController,
isPlaying: _isPlaying,
onTap: onTap,
name: e.value.name,
controller: e.key == 0 ? _controller : null,
color: themeData.isDark()
? darken(Color(e.value.color))
: Color(e.value.color),
index: (e.key) * 1.0,
onDismissed: onDismiss,
);
}),
)
.toList()
.reversed,
],
),
),
Expanded(
flex: 1,
child: TweenAnimationBuilder(
duration: const Duration(milliseconds: 350),
tween: Tween(begin: 0, end: value.isEmpty ? 300 : 0),
curve: Curves.easeInCirc,
builder: ((context, double value, child) =>
Transform.translate(
offset: Offset(0, value),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
flex: 1,
child: TextButton(
onPressed: () {
setState(() {
_isSkipped = true;
});
},
child: const Column(
mainAxisAlignment:
MainAxisAlignment.end,
children: [
Icon(Icons.swipe_left_rounded),
SizedBox(height: 10),
Text("Skip"),
],
),
),
),
Expanded(
flex: 1,
child: ElevatedButton(
onPressed: () {
onTap(null);
},
style: ButtonStyle(
elevation: WidgetStateProperty
.all(6),
shape: WidgetStateProperty.all(
const CircleBorder()),
padding: WidgetStateProperty.all(
const EdgeInsets.all(15)),
),
child: AnimatedIcon(
icon: AnimatedIcons.play_pause,
progress: _buttonController,
color: Theme.of(context)
.colorScheme
.primary,
size: 50,
),
)),
Expanded(
flex: 1,
child: TextButton(
onPressed: () {
setState(() {
_isComplete = true;
});
},
child: const Column(
mainAxisAlignment:
MainAxisAlignment.end,
children: [
Icon(Icons.swipe_right_rounded),
SizedBox(height: 10),
Text("Completed"),
],
),
),
),
],
),
))),
)
],
)),
),
),
),
);
}
}
class MyAppBar extends StatelessWidget {
const MyAppBar({
super.key,
});
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: Colors.transparent,
leadingWidth: 80,
leading: Center(
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context).primaryIconTheme.color!, width: 1),
borderRadius: BorderRadius.circular(90)),
child: IconButton(
onPressed: () {},
icon: const Icon(Icons.arrow_back_ios_new_rounded),
color: Theme.of(context).primaryIconTheme.color,
iconSize: 30,
),
),
),
centerTitle: true,
elevation: 0,
);
}
}
================================================
FILE: lib/screens/stats.dart
================================================
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:koduko/components/daily_activity.dart';
import 'package:koduko/components/header.dart';
import 'package:koduko/components/most_productive_hour.dart';
import 'package:koduko/components/productive_day.dart';
import 'package:koduko/components/time_spent_today.dart';
import 'package:koduko/components/weekly_chart.dart';
import 'package:koduko/models/task_event.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:provider/provider.dart';
class Statistics extends StatelessWidget {
const Statistics({super.key});
static const routeName = "/stats";
@override
Widget build(BuildContext context) {
void clearHistory() {
Provider.of(context, listen: false).clearHistory();
}
final textTheme = Theme.of(context).textTheme.apply(
displayColor: Theme.of(context).colorScheme.onSurface,
);
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(15.0),
child: ListView(
children: [
const SizedBox(height: 10),
const ScreenHeader(text: "Statistics", tag: "Statistics"),
const SizedBox(height: 25),
TodayProgress(textTheme: textTheme),
Hero(tag: 'WeeklyChart', child: WeeklyChart(textTheme: textTheme)),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(child: ProductiveHour(textTheme: textTheme)),
Expanded(child: ProductiveDay(textTheme: textTheme)),
],
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(child: TimeSpentToday(textTheme: textTheme)),
],
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"History",
style: textTheme.headlineMedium,
),
TextButton.icon(
onPressed: () async {
final b = await showDialog(
context: context,
builder: ((context) => AlertDialog(
title: const Text("Clear History"),
content: const Text(
"This is an irreversible action. This will delete all your stats."),
actions: [
TextButton(
onPressed: (() =>
Navigator.pop(context, false)),
child: const Text("CANCEL"),
),
TextButton(
style: TextButton.styleFrom(
foregroundColor:
Theme.of(context).colorScheme.error),
onPressed: (() =>
Navigator.pop(context, true)),
child: const Text("DELETE"),
)
],
)),
);
if (b == true) {
clearHistory();
}
},
style:
TextButton.styleFrom(foregroundColor: Colors.red[300]),
icon: const Icon(Icons.delete),
label: const Text("Clear History"))
],
),
const SizedBox(height: 15),
Selector>(
builder: ((context, value, child) => Column(
children: value.reversed
.map((e) => Card(
child: ListTile(
trailing: IconButton(
onPressed: () => Provider.of(
context,
listen: false)
.removeHistory(e.id),
color: Colors.red[300],
icon: const Icon(Icons.close,
semanticLabel: 'Delete'),
),
// onTap: () => ,
title: Text(e.taskName),
subtitle: Text(DateFormat("MMMM d, y")
.add_jm()
.format(e.time)),
),
))
.toList(),
)),
selector: (p0, p1) => p1.getHistory())
],
),
),
);
}
}
================================================
FILE: lib/screens/tasks.dart
================================================
import 'package:flutter/material.dart';
import 'package:koduko/components/create_task_bottom_sheet.dart';
import 'package:koduko/components/header.dart';
import 'package:koduko/components/task_tile.dart';
import 'package:koduko/models/task.dart';
import 'package:koduko/services/routines_provider.dart';
import 'package:koduko/services/tasks_provider.dart';
import 'package:provider/provider.dart';
class TasksScreen extends StatelessWidget {
const TasksScreen({super.key, this.isBottomNavWidget = false});
static const routeName = "/tasks";
final bool isBottomNavWidget;
@override
Widget build(BuildContext context) {
void addTask(Task t) {
Provider.of(context, listen: false).add(t);
}
void onEdit(Task t) {
Provider.of(context, listen: false).edit(t);
Provider.of(context, listen: false).editTask(t);
}
void onCreateTask() async {
Task? t = await showModalBottomSheet(
isScrollControlled: true,
isDismissible: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(10),
bottom: Radius.zero,
),
),
context: context,
builder: ((context) => const CreateTaskBottomSheet()));
if (t != null) {
addTask(t);
}
}
return Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: onCreateTask,
child: const Icon(Icons.add),
),
body: Consumer(
builder: ((context, value, child) => value.tasks.isEmpty
? SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 20, horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
child ?? Container(),
const Spacer(),
Text(
"Looks like you haven't created any tasks",
style: Theme.of(context)
.textTheme
.headlineMedium!
.apply(
color: Theme.of(context)
.colorScheme
.onSurface),
textAlign: TextAlign.center,
),
const SizedBox(height: 10),
Center(
child: TextButton.icon(
icon: const Icon(Icons.add),
onPressed: onCreateTask,
label: const Text(
"Create One",
style: TextStyle(fontSize: 18),
)),
),
const Spacer(),
],
),
),
)
: ListView.builder(
itemCount: value.tasks.length,
itemBuilder: (context, index) {
if (index == 0) {
return Padding(
padding:
const EdgeInsets.only(top: 20, right: 10, left: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
child ?? Container(),
const SizedBox(height: 25),
TaskTile(
task: value.tasks[index],
onEdit: onEdit,
)
],
),
);
}
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: TaskTile(
task: value.tasks[index],
onEdit: onEdit,
));
})),
child: isBottomNavWidget
? Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Text(
"My Task",
style: Theme.of(context).textTheme.headlineLarge!.apply(
color: Theme.of(context).colorScheme.onSurface),
),
)
: const ScreenHeader(
text: "My Tasks",
tag: "My Tasks",
)),
);
}
}
================================================
FILE: lib/services/notification_service.dart
================================================
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:intl/intl.dart';
import 'package:rxdart/subjects.dart';
import 'package:timezone/timezone.dart' as tz;
class NotificationService {
static final NotificationService _notificationService =
NotificationService._internal();
factory NotificationService() {
return _notificationService;
}
NotificationService._internal();
final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
final BehaviorSubject onNotificationClick = BehaviorSubject();
Future showNotification({
required String title,
required String body,
required String uId,
}) async {
await _flutterLocalNotificationsPlugin.show(
0,
title,
body,
NotificationDetails(
android: AndroidNotificationDetails(
'001',
'Notifications',
channelDescription: 'Notifications',
tag: uId,
),
),
);
}
Future scheduleDaily({
required TimeOfDay time,
required String title,
required String des,
required String uId,
}) async {
await _flutterLocalNotificationsPlugin.zonedSchedule(
ValueKey(uId).hashCode,
title,
des,
_dailyAt(time),
const NotificationDetails(
android: AndroidNotificationDetails(
'002',
'Daily Routine Notifications',
channelDescription: 'Daily Routine Notifications',
),
),
payload: uId,
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
matchDateTimeComponents: DateTimeComponents.time,
);
}
Future scheduleWeekly({
required TimeOfDay time,
required String title,
required String des,
required String day,
required String uId,
}) async {
await _flutterLocalNotificationsPlugin.zonedSchedule(
ValueKey(uId + day).hashCode,
title,
des,
_scheduleWeekly(time, day),
const NotificationDetails(
android: AndroidNotificationDetails(
'003',
'Weekly Routine Notifications',
channelDescription: 'Weekly Routine Notifications',
),
),
payload: uId,
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
matchDateTimeComponents: DateTimeComponents.dayOfWeekAndTime,
);
}
// Future showProgressNotification(
// double value,
// String name,
// String sub,
// ) async {
// final progress = (value * 100).toInt();
// final AndroidNotificationDetails androidPlatformChannelSpecifics =
// AndroidNotificationDetails(
// 'task progress channel',
// 'task progress channel',
// channelDescription: 'displays current task progress',
// channelShowBadge: false,
// priority: Priority.high,
// onlyAlertOnce: true,
// showProgress: true,
// maxProgress: 100,
// progress: progress,
// );
// final NotificationDetails platformChannelSpecifics =
// NotificationDetails(android: androidPlatformChannelSpecifics);
// await _flutterLocalNotificationsPlugin.show(
// 777,
// name,
// sub,
// platformChannelSpecifics,
// );
// }
Future scheduledNotification(
Duration dur, String id, String title, String des) async {
await _flutterLocalNotificationsPlugin.zonedSchedule(
ValueKey(id).hashCode,
title,
des,
tz.TZDateTime.now(tz.local).add(dur),
const NotificationDetails(
android: AndroidNotificationDetails(
'TaskCompleted', 'Task Completed',
channelDescription: 'Task Completed Notification')),
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime);
}
Future getDeviceLaunchInfo() async {
return await _flutterLocalNotificationsPlugin
.getNotificationAppLaunchDetails();
}
Future cancelNotification(String id) async {
await _flutterLocalNotificationsPlugin.cancel(ValueKey(id).hashCode);
}
Future cancelNotificationWithId(int id) async {
await _flutterLocalNotificationsPlugin.cancel(id);
}
Future cancelAllNotifications() async {
await _flutterLocalNotificationsPlugin.cancelAll();
}
tz.TZDateTime _dailyAt(TimeOfDay time) {
final tz.TZDateTime now = tz.TZDateTime.now(tz.local);
tz.TZDateTime scheduledDate = tz.TZDateTime(
tz.local, now.year, now.month, now.day, time.hour, time.minute);
if (scheduledDate.isBefore(now)) {
scheduledDate = scheduledDate.add(const Duration(days: 1));
}
return scheduledDate;
}
tz.TZDateTime _scheduleWeekly(
TimeOfDay time,
String day,
) {
tz.TZDateTime scheduledDate = _dailyAt(time);
var cDay = DateFormat('EEEE').format(scheduledDate);
while (cDay != day) {
scheduledDate = scheduledDate.add(const Duration(days: 1));
cDay = DateFormat('EEEE').format(scheduledDate);
}
return scheduledDate;
}
Future initialize() async {
const AndroidInitializationSettings androidInitializationSettings =
AndroidInitializationSettings('app_icon');
const InitializationSettings settings = InitializationSettings(
android: androidInitializationSettings,
);
void onSelectNotification(NotificationResponse? response) {
if (response != null) {
if (response.payload?.isNotEmpty ?? false) {
onNotificationClick.add(response.payload);
}
}
}
await _flutterLocalNotificationsPlugin.initialize(
settings,
onDidReceiveNotificationResponse: onSelectNotification,
);
}
}
================================================
FILE: lib/services/routines_provider.dart
================================================
import 'dart:collection';
import 'dart:math';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:intl/intl.dart';
import 'package:koduko/models/routine.dart';
import 'package:koduko/models/task.dart';
import 'package:koduko/models/task_event.dart';
import 'package:koduko/services/notification_service.dart';
import 'package:koduko/utils/time_of_day_util.dart';
import 'package:koduko/utils/date_time_extension.dart';
class RoutineModel extends ChangeNotifier {
late final List _routines;
final _box = Hive.box('Routines');
bool notifications = true;
RoutineModel() {
_init();
}
void _init() async {
if (_box.isOpen) {
_routines = _box.values.toList();
} else {
await Hive.openBox("Routines");
}
final box = Hive.box('Theme');
if (box.isOpen) {
notifications = box.get("notifications") ?? true;
} else {
await Hive.openBox("Theme");
}
}
UnmodifiableListView get routines => UnmodifiableListView(_routines);
void add(Routine routine) {
_routines.add(routine);
_box.add(routine);
if (routine.days.length == 7) {
if (routine.time != null) {
NotificationService().scheduleDaily(
time: dateTimeToTimeOfDay(routine.time!),
title: routine.name,
des: "Tap to Start",
uId: routine.id,
);
}
} else {
if (routine.time != null) {
scheduleWeekly(routine);
}
}
notifyListeners();
}
void edit(Routine routine) async {
int index = _routines
.indexWhere((element) => element.id.compareTo(routine.id) == 0);
if (index > -1) {
_box.putAt(index, routine);
_routines[index] = routine;
if (routine.days.length == 7) {
if (routine.time != null) {
NotificationService().scheduleDaily(
time: dateTimeToTimeOfDay(routine.time!),
title: routine.name,
des: "Tap to Start",
uId: routine.id,
);
}
} else {
if (routine.time != null) {
scheduleWeekly(routine);
}
}
notifyListeners();
}
}
List getHistory({int clamp = 0}) {
List list = [];
for (var element in _routines) {
list.addAll(element.history);
list.sort(((a, b) => a.time.compareTo(b.time)));
}
if (list.isEmpty) {
return [];
}
return list.slice(0, min(list.length - 1, 25));
}
int getMostProductiveHour() {
List list = getHistory();
List hours = List.filled(24, 0);
for (var e in list) {
hours[e.time.hour] += 1;
}
int max = 0;
for (var i = 0; i < 24; i++) {
if (hours[i] > hours[max]) {
max = i;
}
}
return max;
}
int getTimeSpentToday() {
List list = _routines;
Duration d = Duration.zero;
for (var e in list) {
d += e.getTimeSpentToday();
}
return d.inMinutes;
}
DateTime? getMostProductiveDay() {
List list = getHistory();
final Map hours = HashMap();
for (var e in list) {
if (hours.containsKey(e.time)) {
hours.update(e.time, (value) => value + 1);
} else {
hours.addAll({e.time: 0});
}
}
if (hours.isNotEmpty) {
DateTime max = hours.keys.first;
hours.forEach((key, value) {
if (value > (hours[max] ?? 0)) {
max = key;
}
});
return max;
}
return null;
}
void skipTask(String id) {
int index =
_routines.indexWhere((element) => element.id.compareTo(id) == 0);
if (index > -1) {
var r = _routines[index].skipTask();
_box.putAt(index, r);
_routines[index] = r;
notifyListeners();
}
}
Routine? getRoutine(String id) {
int index =
_routines.indexWhere((element) => element.id.compareTo(id) == 0);
if (index > -1) {
return _routines[index];
}
return null;
}
List getWeeklyStats() {
var startOfWeek = DateTime(DateTime.now().year, DateTime.now().month,
DateTime.now().day - (DateTime.now().weekday - 1));
List data = [];
for (var i = 0; i < 7; i++) {
var noOfTasks = 0;
var day = startOfWeek.add(Duration(days: i));
for (var element in _routines) {
noOfTasks += element.getCompletedTasks(day);
}
data.add(noOfTasks);
}
return data;
}
int getRoutineStartMaxDays(String id) {
final r = getRoutine(id);
if (r != null) {
if (r.history.isNotEmpty) {
return (DateTime.now().difference(r.history.last.time).inHours / 24)
.ceil();
}
}
return 0;
}
List getRoutineStats(String id) {
final r = getRoutine(id);
List data = [];
if (r != null) {
if (r.history.isNotEmpty) {
final max = getRoutineStartMaxDays(id);
var start =
r.history.last.time.add(Duration(days: max > 7 ? max - 7 : 0));
for (var i = max > 7 ? (max - 7) : 0; i <= max; i++) {
var noOfTasks = 0;
for (var element in r.history) {
if (element.time.isSameDate(start)) {
noOfTasks++;
}
}
start = start.add(const Duration(days: 1));
data.add(noOfTasks);
}
}
}
return data;
}
DateTime getStartDate(String id) {
final r = getRoutine(id);
if (r != null) {
if (r.history.isNotEmpty) {
final max = getRoutineStartMaxDays(id);
return r.history.last.time.add(Duration(days: max > 7 ? max - 7 : 0));
}
}
return DateTime.now();
}
void removeHistory(String tid) {
for (var i = 0; i < _routines.length; i++) {
final r = _routines[i].removeHistory(tid);
if (r != null) {
_box.putAt(i, r);
_routines[i] = r;
}
}
notifyListeners();
}
void clearHistory() {
if (_routines.isNotEmpty) {
for (var i = 0; i < _routines.length; i++) {
final r = _routines[i].clearHistory();
_box.putAt(i, r);
_routines[i] = r;
}
notifyListeners();
}
}
List getRoutineDayFrequencyStats(String id) {
final r = getRoutine(id);
List data = [];
if (r != null) {
for (var i = 0; i < 24; i++) {
var noOfTasks = 0;
for (var element in r.history) {
if (element.time.hour == i) {
noOfTasks++;
}
}
data.add(noOfTasks);
}
}
return data;
}
int totalNoOfTasksToday() {
int noOfTasks = 0;
for (var element in _routines) {
if (!element.isArchive) {
if (element.isToday()) {
if (element.isToday()) {
noOfTasks += element.tasks.length;
}
}
}
}
return noOfTasks;
}
int totalNoOfCompletedTasksToday() {
int noOfTasks = 0;
for (var element in _routines) {
if (!element.isArchive) {
if (element.isToday()) {
noOfTasks += (element.isCompleted
? element.tasks.length
: element.tasks.length - element.inCompletedTasks.length);
}
}
}
return noOfTasks;
}
void completeTask(String id) {
int index =
_routines.indexWhere((element) => element.id.compareTo(id) == 0);
if (index > -1) {
var r = _routines[index].completeTask();
_box.putAt(index, r);
_routines[index] = r;
notifyListeners();
}
}
void replay(String id) {
int index =
_routines.indexWhere((element) => element.id.compareTo(id) == 0);
if (index > -1) {
var r = _routines[index].replay();
_box.putAt(index, r);
_routines[index] = r;
notifyListeners();
}
}
void editTask(Task t) {
List temp = List.from(_routines);
temp.asMap().map((key, value) {
Routine? r = value.editTasks(t);
if (r != null) {
_box.putAt(key, r);
_routines[key] = r;
}
return MapEntry(key, value);
});
notifyListeners();
}
void toggleMarkAsCompleted(String id) {
int index =
_routines.indexWhere((element) => element.id.compareTo(id) == 0);
if (index > -1) {
var r = _routines[index];
if (_routines[index].isCompleted) {
r = _routines[index].markAsInCompleted();
} else {
r = _routines[index].markAsCompleted();
}
_box.putAt(index, r);
_routines[index] = r;
notifyListeners();
}
}
void removeTask(Task t) {
List temp = List.from(_routines);
temp.asMap().map((key, value) {
Routine? r = value.taskExists(t);
if (r != null) {
if (r.tasks.isEmpty) {
int index = _routines
.indexWhere((element) => element.id.compareTo(r.id) == 0);
if (index > -1) {
_box.deleteAt(index);
_routines.removeWhere((element) => element.id.compareTo(r.id) == 0);
}
delete(r.id);
} else {
_box.putAt(key, r);
_routines[key] = r;
}
}
return MapEntry(key, value);
});
notifyListeners();
}
void delete(String id) {
int index =
_routines.indexWhere((element) => element.id.compareTo(id) == 0);
if (index > -1) {
NotificationService().cancelNotification(id);
_box.deleteAt(index);
_routines.removeWhere((element) => element.id.compareTo(id) == 0);
notifyListeners();
}
}
List todaysRoutines() {
return routines
.where((element) => element.isArchive == false)
.where(
(element) => element.days.contains(
DateFormat('EEEE').format(DateTime.now()),
),
)
.toList();
}
List allRoutines() {
return routines
.where((element) => element.isArchive == false)
.where(
(element) => !element.days.contains(
DateFormat('EEEE').format(DateTime.now()),
),
)
.toList();
}
List archiveRoutines() {
return routines.where((element) => element.isArchive == true).toList();
}
void addToArchive(String id) {
int index =
_routines.indexWhere((element) => element.id.compareTo(id) == 0);
if (index > -1) {
var r = _routines[index].addToArchive();
NotificationService().cancelNotification(r.id);
_box.putAt(index, r);
_routines[index] = r;
notifyListeners();
}
}
void removeFromArchive(String id) {
int index =
_routines.indexWhere((element) => element.id.compareTo(id) == 0);
if (index > -1) {
var r = _routines[index].removeFromArchive();
_box.putAt(index, r);
_routines[index] = r;
if (r.days.length == 7) {
if (r.time != null) {
NotificationService().scheduleDaily(
time: dateTimeToTimeOfDay(r.time!),
title: r.name,
des: "Tap to Start",
uId: r.id,
);
}
} else {
if (r.time != null) {
scheduleWeekly(r);
}
}
notifyListeners();
}
}
void toggleNotifications() {
final box = Hive.box('Theme');
if (notifications) {
box.put("notifications", false);
cancelAllNotifications();
notifications = false;
notifyListeners();
} else {
box.put("notifications", true);
enableAllNotifications();
notifications = true;
notifyListeners();
}
}
void enableAllNotifications() {
for (var element in _routines) {
if (!element.isArchive) {
if (element.days.length == 7) {
if (element.time != null) {
NotificationService().scheduleDaily(
time: dateTimeToTimeOfDay(element.time!),
title: element.name,
des: "Tap to Start",
uId: element.id,
);
}
} else {
if (element.time != null) {
scheduleWeekly(element);
}
}
}
}
}
void scheduleWeekly(Routine r) {
for (var day in r.days) {
NotificationService().scheduleWeekly(
day: day,
time: dateTimeToTimeOfDay(r.time!),
title: r.name,
des: "Tap to Start",
uId: r.id,
);
}
}
void cancelAllNotifications() {
NotificationService().cancelAllNotifications();
}
}
================================================
FILE: lib/services/tasks_provider.dart
================================================
import 'dart:collection';
import 'package:flutter/material.dart';
import 'package:hive_flutter/adapters.dart';
import 'package:koduko/models/task.dart';
class TaskModel extends ChangeNotifier {
late final List _tasks;
final _box = Hive.box('Tasks');
UnmodifiableListView get tasks => UnmodifiableListView(_tasks);
TaskModel() {
_init();
}
void _init() async {
if (_box.isOpen) {
_tasks = _box.values.toList();
} else {
await Hive.openBox('Tasks');
}
}
void add(Task task) {
_tasks.add(task);
_box.add(task);
notifyListeners();
}
void edit(Task task) {
int index =
_tasks.indexWhere((element) => element.id.compareTo(task.id) == 0);
if (index > -1) {
_box.putAt(index, task);
_tasks[index] = task;
notifyListeners();
}
}
void delete(String id) {
if (_tasks.indexWhere((element) => element.id.compareTo(id) == 0) > -1) {
_box.deleteAt(
_tasks.indexWhere((element) => element.id.compareTo(id) == 0));
_tasks.removeWhere((element) => element.id.compareTo(id) == 0);
notifyListeners();
}
}
}
================================================
FILE: lib/services/theme_provider.dart
================================================
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
class ThemeModel with ChangeNotifier {
var _themeMode = ThemeMode.system;
final _box = Hive.box('Theme');
get getTheme => _themeMode;
setTheme(themeMode) {
_themeMode = themeMode;
_box.put("darkMode", themeMode == ThemeMode.dark);
notifyListeners();
}
bool isDark() => _themeMode == ThemeMode.dark;
ThemeModel() {
if (_box.isOpen) {
if (_box.get("darkMode") != null) {
_themeMode = _box.get("darkMode")! ? ThemeMode.dark : ThemeMode.light;
} else {
_themeMode = ThemeMode.system;
}
}
}
toggleTheme() {
switch (_themeMode) {
case ThemeMode.dark:
_themeMode = ThemeMode.light;
_box.put("darkMode", false);
break;
case ThemeMode.light:
_themeMode = ThemeMode.system;
_box.delete('darkMode');
break;
case ThemeMode.system:
_themeMode = ThemeMode.dark;
_box.put("darkMode", true);
break;
default:
_themeMode = _themeMode;
}
notifyListeners();
}
}
================================================
FILE: lib/utils/colors_util.dart
================================================
import 'package:flutter/material.dart';
Color darken(Color color, [double amount = .1]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(color);
final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0));
return hslDark.toColor();
}
Color lighten(Color color, [double amount = .1]) {
assert(amount >= 0 && amount <= 1);
final hsl = HSLColor.fromColor(color);
final hslLight = hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0));
return hslLight.toColor();
}
================================================
FILE: lib/utils/date_time_extension.dart
================================================
extension DateOnlyCompare on DateTime {
bool isSameDate(DateTime other) {
return year == other.year && month == other.month && day == other.day;
}
}
================================================
FILE: lib/utils/duration_to_string.dart
================================================
String durationToString(Duration duration) {
return '${duration.inMinutes}:${(duration.inSeconds % 60).toString().padLeft(2, '0')}';
}
================================================
FILE: lib/utils/greetings.dart
================================================
String greeting() {
var hour = DateTime.now().hour;
if (hour < 12) {
return 'Morning';
}
if (hour < 17) {
return 'Afternoon';
}
return 'Evening';
}
================================================
FILE: lib/utils/parse_duration.dart
================================================
Duration parseDuration(String s) {
int hours = 0;
int minutes = 0;
int micros;
List parts = s.split(':');
if (parts.length > 2) {
hours = int.parse(parts[parts.length - 3]);
}
if (parts.length > 1) {
minutes = int.parse(parts[parts.length - 2]);
}
micros = (double.parse(parts[parts.length - 1]) * 1000000).round();
return Duration(hours: hours, minutes: minutes, microseconds: micros);
}
================================================
FILE: lib/utils/time_of_day_util.dart
================================================
import 'package:flutter/material.dart';
DateTime? timeOfDayToDateTime(TimeOfDay? t) {
if (t == null) {
return null;
}
final now = DateTime.now();
return DateTime(now.year, now.month, now.day, t.hour, t.minute);
}
TimeOfDay dateTimeToTimeOfDay(DateTime t) {
return TimeOfDay.fromDateTime(t);
}
================================================
FILE: linux/.gitignore
================================================
flutter/ephemeral
================================================
FILE: linux/CMakeLists.txt
================================================
# Project-level configuration.
cmake_minimum_required(VERSION 3.10)
project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "koduko")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.koduko")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(SET CMP0063 NEW)
# Load bundled libraries from the lib/ directory relative to the binary.
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
# Root filesystem for cross-building.
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
# Define build configuration options.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
# Compilation settings that should be applied to most targets.
#
# Be cautious about adding new options here, as plugins use this function by
# default. In most cases, you should add new options to specific targets instead
# of modifying this function.
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
endfunction()
# Flutter library and tool build rules.
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
add_subdirectory(${FLUTTER_MANAGED_DIR})
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Define the application target. To change its name, change BINARY_NAME above,
# not the value here, or `flutter run` will no longer work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Add dependency libraries. Add any application-specific dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)
# Only the install-generated bundle's copy of the executable will launch
# correctly, since the resources must in the right relative locations. To avoid
# people trying to run the unbundled copy, put it in a subdirectory instead of
# the default top-level location.
set_target_properties(${BINARY_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)
# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
# === Installation ===
# By default, "installing" just makes a relocatable bundle in the build
# directory.
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
# Start with a clean build bundle directory every time.
install(CODE "
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
" COMPONENT Runtime)
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
install(FILES "${bundled_library}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endforeach(bundled_library)
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
# Install the AOT library on non-Debug builds only.
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
================================================
FILE: linux/flutter/CMakeLists.txt
================================================
# This file controls Flutter-level build steps. It should not be edited.
cmake_minimum_required(VERSION 3.10)
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
# Configuration provided via flutter tool.
include(${EPHEMERAL_DIR}/generated_config.cmake)
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
# which isn't available in 3.10.
function(list_prepend LIST_NAME PREFIX)
set(NEW_LIST "")
foreach(element ${${LIST_NAME}})
list(APPEND NEW_LIST "${PREFIX}${element}")
endforeach(element)
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
endfunction()
# === Flutter Library ===
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
list(APPEND FLUTTER_LIBRARY_HEADERS
"fl_basic_message_channel.h"
"fl_binary_codec.h"
"fl_binary_messenger.h"
"fl_dart_project.h"
"fl_engine.h"
"fl_json_message_codec.h"
"fl_json_method_codec.h"
"fl_message_codec.h"
"fl_method_call.h"
"fl_method_channel.h"
"fl_method_codec.h"
"fl_method_response.h"
"fl_plugin_registrar.h"
"fl_plugin_registry.h"
"fl_standard_message_codec.h"
"fl_standard_method_codec.h"
"fl_string_codec.h"
"fl_value.h"
"fl_view.h"
"flutter_linux.h"
)
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
target_link_libraries(flutter INTERFACE
PkgConfig::GTK
PkgConfig::GLIB
PkgConfig::GIO
)
add_dependencies(flutter flutter_assemble)
# === Flutter tool backend ===
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/_phony_
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
)
================================================
FILE: linux/flutter/generated_plugin_registrant.cc
================================================
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include
#include
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}
================================================
FILE: linux/flutter/generated_plugin_registrant.h
================================================
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include
// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_
================================================
FILE: linux/flutter/generated_plugins.cmake
================================================
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
dynamic_color
url_launcher_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
================================================
FILE: linux/main.cc
================================================
#include "my_application.h"
int main(int argc, char** argv) {
g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
}
================================================
FILE: linux/my_application.cc
================================================
#include "my_application.h"
#include
#ifdef GDK_WINDOWING_X11
#include
#endif
#include "flutter/generated_plugin_registrant.h"
struct _MyApplication {
GtkApplication parent_instance;
char** dart_entrypoint_arguments;
};
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
gboolean use_header_bar = TRUE;
#ifdef GDK_WINDOWING_X11
GdkScreen* screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
use_header_bar = FALSE;
}
}
#endif
if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "koduko");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else {
gtk_window_set_title(window, "koduko");
}
gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}
// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
MyApplication* self = MY_APPLICATION(application);
// Strip out the first argument as it is the binary name.
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
g_autoptr(GError) error = nullptr;
if (!g_application_register(application, nullptr, &error)) {
g_warning("Failed to register: %s", error->message);
*exit_status = 1;
return TRUE;
}
g_application_activate(application);
*exit_status = 0;
return TRUE;
}
// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
MyApplication* self = MY_APPLICATION(object);
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE,
nullptr));
}
================================================
FILE: linux/my_application.h
================================================
#ifndef FLUTTER_MY_APPLICATION_H_
#define FLUTTER_MY_APPLICATION_H_
#include
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
GtkApplication)
/**
* my_application_new:
*
* Creates a new Flutter-based application.
*
* Returns: a new #MyApplication.
*/
MyApplication* my_application_new();
#endif // FLUTTER_MY_APPLICATION_H_
================================================
FILE: macos/.gitignore
================================================
# Flutter-related
**/Flutter/ephemeral/
**/Pods/
# Xcode-related
**/dgph
**/xcuserdata/
================================================
FILE: macos/Flutter/Flutter-Debug.xcconfig
================================================
#include "ephemeral/Flutter-Generated.xcconfig"
================================================
FILE: macos/Flutter/Flutter-Release.xcconfig
================================================
#include "ephemeral/Flutter-Generated.xcconfig"
================================================
FILE: macos/Flutter/GeneratedPluginRegistrant.swift
================================================
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import dynamic_color
import flutter_local_notifications
import flutter_native_timezone
import path_provider_foundation
import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
FlutterNativeTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterNativeTimezonePlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
================================================
FILE: macos/Runner/AppDelegate.swift
================================================
import Cocoa
import FlutterMacOS
@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}
================================================
FILE: macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "app_icon_16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "app_icon_32.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "app_icon_32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "app_icon_64.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "app_icon_128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "app_icon_256.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "app_icon_256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "app_icon_512.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "app_icon_512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "app_icon_1024.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: macos/Runner/Base.lproj/MainMenu.xib
================================================
================================================
FILE: macos/Runner/Configs/AppInfo.xcconfig
================================================
// Application-level settings for the Runner target.
//
// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
// future. If not, the values below would default to using the project name when this becomes a
// 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = koduko
// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.example.koduko
// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved.
================================================
FILE: macos/Runner/Configs/Debug.xcconfig
================================================
#include "../../Flutter/Flutter-Debug.xcconfig"
#include "Warnings.xcconfig"
================================================
FILE: macos/Runner/Configs/Release.xcconfig
================================================
#include "../../Flutter/Flutter-Release.xcconfig"
#include "Warnings.xcconfig"
================================================
FILE: macos/Runner/Configs/Warnings.xcconfig
================================================
WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
CLANG_WARN_PRAGMA_PACK = YES
CLANG_WARN_STRICT_PROTOTYPES = YES
CLANG_WARN_COMMA = YES
GCC_WARN_STRICT_SELECTOR_MATCH = YES
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
GCC_WARN_SHADOW = YES
CLANG_WARN_UNREACHABLE_CODE = YES
================================================
FILE: macos/Runner/DebugProfile.entitlements
================================================
com.apple.security.app-sandbox
com.apple.security.cs.allow-jit
com.apple.security.network.server
================================================
FILE: macos/Runner/Info.plist
================================================
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIconFile
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
APPL
CFBundleShortVersionString
$(FLUTTER_BUILD_NAME)
CFBundleVersion
$(FLUTTER_BUILD_NUMBER)
LSMinimumSystemVersion
$(MACOSX_DEPLOYMENT_TARGET)
NSHumanReadableCopyright
$(PRODUCT_COPYRIGHT)
NSMainNibFile
MainMenu
NSPrincipalClass
NSApplication
================================================
FILE: macos/Runner/MainFlutterWindow.swift
================================================
import Cocoa
import FlutterMacOS
class MainFlutterWindow: NSWindow {
override func awakeFromNib() {
let flutterViewController = FlutterViewController.init()
let windowFrame = self.frame
self.contentViewController = flutterViewController
self.setFrame(windowFrame, display: true)
RegisterGeneratedPlugins(registry: flutterViewController)
super.awakeFromNib()
}
}
================================================
FILE: macos/Runner/Release.entitlements
================================================
com.apple.security.app-sandbox
================================================
FILE: macos/Runner.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objects = {
/* Begin PBXAggregateTarget section */
33CC111A2044C6BA0003C045 /* Flutter Assemble */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */;
buildPhases = (
33CC111E2044C6BF0003C045 /* ShellScript */,
);
dependencies = (
);
name = "Flutter Assemble";
productName = FLX;
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 33CC111A2044C6BA0003C045;
remoteInfo = FLX;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
33CC110E2044A8840003C045 /* Bundle Framework */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; };
33CC10ED2044A3C60003C045 /* koduko.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "koduko.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; };
33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; };
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; };
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; };
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; };
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; };
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
33CC10EA2044A3C60003C045 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
33BA886A226E78AF003329D5 /* Configs */ = {
isa = PBXGroup;
children = (
33E5194F232828860026EE4D /* AppInfo.xcconfig */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
333000ED22D3DE5D00554162 /* Warnings.xcconfig */,
);
path = Configs;
sourceTree = "";
};
33CC10E42044A3C60003C045 = {
isa = PBXGroup;
children = (
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
33CC10EE2044A3C60003C045 /* Products */,
D73912EC22F37F3D000D13A0 /* Frameworks */,
);
sourceTree = "";
};
33CC10EE2044A3C60003C045 /* Products */ = {
isa = PBXGroup;
children = (
33CC10ED2044A3C60003C045 /* koduko.app */,
);
name = Products;
sourceTree = "";
};
33CC11242044D66E0003C045 /* Resources */ = {
isa = PBXGroup;
children = (
33CC10F22044A3C60003C045 /* Assets.xcassets */,
33CC10F42044A3C60003C045 /* MainMenu.xib */,
33CC10F72044A3C60003C045 /* Info.plist */,
);
name = Resources;
path = ..;
sourceTree = "";
};
33CEB47122A05771004F2AC0 /* Flutter */ = {
isa = PBXGroup;
children = (
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */,
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
);
path = Flutter;
sourceTree = "";
};
33FAB671232836740065AC1E /* Runner */ = {
isa = PBXGroup;
children = (
33CC10F02044A3C60003C045 /* AppDelegate.swift */,
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
33E51913231747F40026EE4D /* DebugProfile.entitlements */,
33E51914231749380026EE4D /* Release.entitlements */,
33CC11242044D66E0003C045 /* Resources */,
33BA886A226E78AF003329D5 /* Configs */,
);
path = Runner;
sourceTree = "";
};
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
33CC10EC2044A3C60003C045 /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
33CC10E92044A3C60003C045 /* Sources */,
33CC10EA2044A3C60003C045 /* Frameworks */,
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
);
buildRules = (
);
dependencies = (
33CC11202044C79F0003C045 /* PBXTargetDependency */,
);
name = Runner;
productName = Runner;
productReference = 33CC10ED2044A3C60003C045 /* koduko.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
33CC10E52044A3C60003C045 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1100;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.Sandbox = {
enabled = 1;
};
};
};
33CC111A2044C6BA0003C045 = {
CreatedOnToolsVersion = 9.2;
ProvisioningStyle = Manual;
};
};
};
buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 33CC10E42044A3C60003C045;
productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
33CC10EC2044A3C60003C045 /* Runner */,
33CC111A2044C6BA0003C045 /* Flutter Assemble */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
33CC10EB2044A3C60003C045 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
};
33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
Flutter/ephemeral/FlutterInputs.xcfilelist,
);
inputPaths = (
Flutter/ephemeral/tripwire,
);
outputFileListPaths = (
Flutter/ephemeral/FlutterOutputs.xcfilelist,
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
33CC10E92044A3C60003C045 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
33CC11202044C79F0003C045 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */;
targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
33CC10F42044A3C60003C045 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
33CC10F52044A3C60003C045 /* Base */,
);
name = MainMenu.xib;
path = Runner;
sourceTree = "";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
338D0CE9231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Profile;
};
338D0CEA231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Profile;
};
338D0CEB231458BD00FA5F75 /* Profile */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Manual;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Profile;
};
33CC10F92044A3C60003C045 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
33CC10FA2044A3C60003C045 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
33CC10FC2044A3C60003C045 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
33CC10FD2044A3C60003C045 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Release;
};
33CC111C2044C6BA0003C045 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Manual;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
33CC111D2044C6BA0003C045 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC10F92044A3C60003C045 /* Debug */,
33CC10FA2044A3C60003C045 /* Release */,
338D0CE9231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC10FC2044A3C60003C045 /* Debug */,
33CC10FD2044A3C60003C045 /* Release */,
338D0CEA231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = {
isa = XCConfigurationList;
buildConfigurations = (
33CC111C2044C6BA0003C045 /* Debug */,
33CC111D2044C6BA0003C045 /* Release */,
338D0CEB231458BD00FA5F75 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 33CC10E52044A3C60003C045 /* Project object */;
}
================================================
FILE: macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
IDEDidComputeMac32BitWarning
================================================
FILE: macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
================================================
================================================
FILE: macos/Runner.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
IDEDidComputeMac32BitWarning
================================================
FILE: pubspec.yaml
================================================
name: koduko
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.2+4
environment:
sdk: ">=2.17.1 <3.22.1"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
hive_flutter: ^1.1.0
hive: ^2.2.3
provider: ^6.0.3
uuid: ^4.4.0
google_fonts: ^6.2.1
intl: ^0.19.0
fl_chart: ^0.68.0
flutter_slidable: ^3.1.0
percent_indicator: ^4.2.2
collection: ^1.16.0
flutter_local_notifications: ^17.1.2
rxdart: ^0.28.0
timezone: ^0.9.0
flutter_native_timezone: ^2.0.0
url_launcher: ^6.1.5
dynamic_color: ^1.6.9
duration_picker: ^1.2.0
logger: ^2.3.0
# flutter_icons:
# android: "launcher_icon"
# ios: true
# image_path: "assets/icon/icon.png"
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
hive_generator: ^2.0.1
build_runner: ^2.1.11
flutter_launcher_icons: ^0.13.1
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/icon/icon.png
- assets/onboarding/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
================================================
FILE: test/widget_test.dart
================================================
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:koduko/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
================================================
FILE: web/index.html
================================================
koduko
================================================
FILE: web/manifest.json
================================================
{
"name": "koduko",
"short_name": "koduko",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "icons/Icon-maskable-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "icons/Icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
]
}
================================================
FILE: windows/.gitignore
================================================
flutter/ephemeral/
# Visual Studio user-specific files.
*.suo
*.user
*.userosscache
*.sln.docstates
# Visual Studio build-related files.
x64/
x86/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
================================================
FILE: windows/CMakeLists.txt
================================================
# Project-level configuration.
cmake_minimum_required(VERSION 3.14)
project(koduko LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "koduko")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(SET CMP0063 NEW)
# Define build configuration option.
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(IS_MULTICONFIG)
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
CACHE STRING "" FORCE)
else()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
endif()
# Define settings for the Profile build mode.
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
# Use Unicode for all projects.
add_definitions(-DUNICODE -D_UNICODE)
# Compilation settings that should be applied to most targets.
#
# Be cautious about adding new options here, as plugins use this function by
# default. In most cases, you should add new options to specific targets instead
# of modifying this function.
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_17)
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
target_compile_options(${TARGET} PRIVATE /EHsc)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
endfunction()
# Flutter library and tool build rules.
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
add_subdirectory(${FLUTTER_MANAGED_DIR})
# Application build; see runner/CMakeLists.txt.
add_subdirectory("runner")
# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
# === Installation ===
# Support files are copied into place next to the executable, so that it can
# run in place. This is done instead of making a separate bundle (as on Linux)
# so that building and running from within Visual Studio will work.
set(BUILD_BUNDLE_DIR "$")
# Make the "install" step default, as it's required to run.
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
if(PLUGIN_BUNDLED_LIBRARIES)
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
# Install the AOT library on non-Debug builds only.
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
CONFIGURATIONS Profile;Release
COMPONENT Runtime)
================================================
FILE: windows/flutter/CMakeLists.txt
================================================
# This file controls Flutter-level build steps. It should not be edited.
cmake_minimum_required(VERSION 3.14)
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
# Configuration provided via flutter tool.
include(${EPHEMERAL_DIR}/generated_config.cmake)
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
list(APPEND FLUTTER_LIBRARY_HEADERS
"flutter_export.h"
"flutter_windows.h"
"flutter_messenger.h"
"flutter_plugin_registrar.h"
"flutter_texture_registrar.h"
)
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
add_dependencies(flutter flutter_assemble)
# === Wrapper ===
list(APPEND CPP_WRAPPER_SOURCES_CORE
"core_implementations.cc"
"standard_codec.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
"plugin_registrar.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
list(APPEND CPP_WRAPPER_SOURCES_APP
"flutter_engine.cc"
"flutter_view_controller.cc"
)
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
# Wrapper sources needed for a plugin.
add_library(flutter_wrapper_plugin STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
)
apply_standard_settings(flutter_wrapper_plugin)
set_target_properties(flutter_wrapper_plugin PROPERTIES
POSITION_INDEPENDENT_CODE ON)
set_target_properties(flutter_wrapper_plugin PROPERTIES
CXX_VISIBILITY_PRESET hidden)
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
target_include_directories(flutter_wrapper_plugin PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_plugin flutter_assemble)
# Wrapper sources needed for the runner.
add_library(flutter_wrapper_app STATIC
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_APP}
)
apply_standard_settings(flutter_wrapper_app)
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
target_include_directories(flutter_wrapper_app PUBLIC
"${WRAPPER_ROOT}/include"
)
add_dependencies(flutter_wrapper_app flutter_assemble)
# === Flutter tool backend ===
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
${PHONY_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
${CPP_WRAPPER_SOURCES_CORE}
${CPP_WRAPPER_SOURCES_PLUGIN}
${CPP_WRAPPER_SOURCES_APP}
)
================================================
FILE: windows/flutter/generated_plugin_registrant.cc
================================================
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include
#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
DynamicColorPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
================================================
FILE: windows/flutter/generated_plugin_registrant.h
================================================
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include
// Registers Flutter plugins.
void RegisterPlugins(flutter::PluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_
================================================
FILE: windows/flutter/generated_plugins.cmake
================================================
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
dynamic_color
url_launcher_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
================================================
FILE: windows/runner/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.14)
project(runner LANGUAGES CXX)
# Define the application target. To change its name, change BINARY_NAME in the
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
# work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME} WIN32
"flutter_window.cpp"
"main.cpp"
"utils.cpp"
"win32_window.cpp"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
"Runner.rc"
"runner.exe.manifest"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Disable Windows macros that collide with C++ standard library functions.
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
# Add dependency libraries and include directories. Add any application-specific
# dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)
================================================
FILE: windows/runner/Runner.rc
================================================
// Microsoft Visual C++ generated resource script.
//
#pragma code_page(65001)
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APP_ICON ICON "resources\\app_icon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#else
#define VERSION_AS_NUMBER 1,0,0
#endif
#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#else
#define VERSION_AS_STRING "1.0.0"
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_AS_NUMBER
PRODUCTVERSION VERSION_AS_NUMBER
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "com.example" "\0"
VALUE "FileDescription", "koduko" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "koduko" "\0"
VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
VALUE "OriginalFilename", "koduko.exe" "\0"
VALUE "ProductName", "koduko" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
================================================
FILE: windows/runner/flutter_window.cpp
================================================
#include "flutter_window.h"
#include
#include "flutter/generated_plugin_registrant.h"
FlutterWindow::FlutterWindow(const flutter::DartProject& project)
: project_(project) {}
FlutterWindow::~FlutterWindow() {}
bool FlutterWindow::OnCreate() {
if (!Win32Window::OnCreate()) {
return false;
}
RECT frame = GetClientArea();
// The size here must match the window dimensions to avoid unnecessary surface
// creation / destruction in the startup path.
flutter_controller_ = std::make_unique(
frame.right - frame.left, frame.bottom - frame.top, project_);
// Ensure that basic setup of the controller was successful.
if (!flutter_controller_->engine() || !flutter_controller_->view()) {
return false;
}
RegisterPlugins(flutter_controller_->engine());
SetChildContent(flutter_controller_->view()->GetNativeWindow());
return true;
}
void FlutterWindow::OnDestroy() {
if (flutter_controller_) {
flutter_controller_ = nullptr;
}
Win32Window::OnDestroy();
}
LRESULT
FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
WPARAM const wparam,
LPARAM const lparam) noexcept {
// Give Flutter, including plugins, an opportunity to handle window messages.
if (flutter_controller_) {
std::optional result =
flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
lparam);
if (result) {
return *result;
}
}
switch (message) {
case WM_FONTCHANGE:
flutter_controller_->engine()->ReloadSystemFonts();
break;
}
return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
}
================================================
FILE: windows/runner/flutter_window.h
================================================
#ifndef RUNNER_FLUTTER_WINDOW_H_
#define RUNNER_FLUTTER_WINDOW_H_
#include
#include
#include
#include "win32_window.h"
// A window that does nothing but host a Flutter view.
class FlutterWindow : public Win32Window {
public:
// Creates a new FlutterWindow hosting a Flutter view running |project|.
explicit FlutterWindow(const flutter::DartProject& project);
virtual ~FlutterWindow();
protected:
// Win32Window:
bool OnCreate() override;
void OnDestroy() override;
LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
LPARAM const lparam) noexcept override;
private:
// The project to run.
flutter::DartProject project_;
// The Flutter instance hosted by this window.
std::unique_ptr flutter_controller_;
};
#endif // RUNNER_FLUTTER_WINDOW_H_
================================================
FILE: windows/runner/main.cpp
================================================
#include
#include
#include
#include "flutter_window.h"
#include "utils.h"
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
CreateAndAttachConsole();
}
// Initialize COM, so that it is available for use in the library and/or
// plugins.
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
flutter::DartProject project(L"data");
std::vector command_line_arguments =
GetCommandLineArguments();
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.CreateAndShow(L"koduko", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);
::MSG msg;
while (::GetMessage(&msg, nullptr, 0, 0)) {
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
::CoUninitialize();
return EXIT_SUCCESS;
}
================================================
FILE: windows/runner/resource.h
================================================
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Runner.rc
//
#define IDI_APP_ICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
================================================
FILE: windows/runner/runner.exe.manifest
================================================
PerMonitorV2
================================================
FILE: windows/runner/utils.cpp
================================================
#include "utils.h"
#include
#include
#include
#include
#include
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
_dup2(_fileno(stdout), 2);
}
std::ios::sync_with_stdio();
FlutterDesktopResyncOutputStreams();
}
}
std::vector GetCommandLineArguments() {
// Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
int argc;
wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
if (argv == nullptr) {
return std::vector();
}
std::vector command_line_arguments;
// Skip the first argument as it's the binary name.
for (int i = 1; i < argc; i++) {
command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
}
::LocalFree(argv);
return command_line_arguments;
}
std::string Utf8FromUtf16(const wchar_t* utf16_string) {
if (utf16_string == nullptr) {
return std::string();
}
int target_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
-1, nullptr, 0, nullptr, nullptr);
std::string utf8_string;
if (target_length == 0 || target_length > utf8_string.max_size()) {
return utf8_string;
}
utf8_string.resize(target_length);
int converted_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
-1, utf8_string.data(),
target_length, nullptr, nullptr);
if (converted_length == 0) {
return std::string();
}
return utf8_string;
}
================================================
FILE: windows/runner/utils.h
================================================
#ifndef RUNNER_UTILS_H_
#define RUNNER_UTILS_H_
#include
#include