├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .metadata ├── .vscode └── settings.json ├── 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-hdpi-v11 │ │ │ └── ic_stat_icon.png │ │ │ ├── drawable-hdpi │ │ │ └── app_icon.png │ │ │ ├── drawable-mdpi-v11 │ │ │ └── ic_stat_icon.png │ │ │ ├── drawable-mdpi │ │ │ └── app_icon.png │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable-xhdpi-v11 │ │ │ └── ic_stat_icon.png │ │ │ ├── drawable-xhdpi │ │ │ └── app_icon.png │ │ │ ├── drawable-xxhdpi-v11 │ │ │ └── ic_stat_icon.png │ │ │ ├── drawable-xxhdpi │ │ │ └── app_icon.png │ │ │ ├── drawable-xxxhdpi │ │ │ └── app_icon.png │ │ │ ├── drawable │ │ │ ├── app_icon.png │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-mdpi │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xhdpi │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── launcher_icon.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── icon │ └── icon.png └── onboarding │ ├── gymGuy.png │ ├── gymPerson.png │ ├── gymTime.png │ ├── person.png │ └── watch.png ├── github_assets ├── image1.png ├── image2.png └── image3.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── 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 └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── AppIcon-20@2x.png │ │ ├── AppIcon-20@2x~ipad.png │ │ ├── AppIcon-20@3x.png │ │ ├── AppIcon-20~ipad.png │ │ ├── AppIcon-29.png │ │ ├── AppIcon-29@2x.png │ │ ├── AppIcon-29@2x~ipad.png │ │ ├── AppIcon-29@3x.png │ │ ├── AppIcon-29~ipad.png │ │ ├── AppIcon-40@2x.png │ │ ├── AppIcon-40@2x~ipad.png │ │ ├── AppIcon-40@3x.png │ │ ├── AppIcon-40~ipad.png │ │ ├── AppIcon-60@2x~car.png │ │ ├── AppIcon-60@3x~car.png │ │ ├── AppIcon-83.5@2x~ipad.png │ │ ├── AppIcon@2x.png │ │ ├── AppIcon@2x~ipad.png │ │ ├── AppIcon@3x.png │ │ ├── AppIcon~ios-marketing.png │ │ ├── AppIcon~ipad.png │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── 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.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── app_icon_1024.png │ │ ├── app_icon_128.png │ │ ├── app_icon_16.png │ │ ├── app_icon_256.png │ │ ├── app_icon_32.png │ │ ├── app_icon_512.png │ │ └── app_icon_64.png │ ├── Base.lproj │ └── MainMenu.xib │ ├── Configs │ ├── AppInfo.xcconfig │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── 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 ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Smartphone (please complete the following information):** 27 | - Device: [e.g. iPhone6] 28 | - OS: [e.g. iOS8.1] 29 | - Version [e.g. 22] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | *.jks 19 | 20 | # The .vscode folder contains launch configuration and tasks you configure in 21 | # VS Code which you may wish to be included in version control, so this line 22 | # is commented out by default. 23 | .vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | **/doc/api/ 27 | **/ios/Flutter/.last_build_id 28 | .dart_tool/ 29 | .flutter-plugins 30 | .flutter-plugins-dependencies 31 | .packages 32 | .pub-cache/ 33 | .pub/ 34 | /build/ 35 | 36 | # Web related 37 | lib/generated_plugin_registrant.dart 38 | 39 | # Symbolication related 40 | app.*.symbols 41 | 42 | # Obfuscation related 43 | app.*.map.json 44 | 45 | # Android Studio will place build artifacts here 46 | /android/app/debug 47 | /android/app/profile 48 | /android/app/release 49 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 17 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 18 | - platform: android 19 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 20 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 21 | - platform: ios 22 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 23 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 24 | - platform: linux 25 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 26 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 27 | - platform: macos 28 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 29 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 30 | - platform: web 31 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 32 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 33 | - platform: windows 34 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 35 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": ["koduko", "Kudoku", "lato", "MMMMEEE"] 3 | } 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2021 Mazahir 2 | 3 | MIT License 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Koduko 2 | 3 | Yet another Habit tracker made with flutter. 4 | 5 | 6 | ## ❓ About 7 | 8 | It's an open source and free app where you can manage your daily or weekly habits. 9 | 10 | 11 | 12 | ## 📢 Getting Started 13 | 14 | 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. 15 | 16 | Alternatively you can build the app yourself. See below for further information. 17 | 18 | ## 🔨 Build 19 | 20 | - Clone the repo using `git clone https://github.com/Mazahir26/koduko.git` 21 | 22 | - Install all the dependencies `flutter pub get` 23 | 24 | - To test it out locally you can check this [guide](https://docs.flutter.dev/development/tools/vs-code) 25 | 26 | - To build the apk follow this [guide](https://docs.flutter.dev/deployment/android) 27 | 28 | ## 👀 Preview 29 | 30 | ScreenShort 1ScreenShort 2ScreenShort 3 31 | 32 | ## ⛩️ Features 33 | 34 | - Notification Support, 35 | - Material 3 Design, 36 | - No ads, 37 | - Insightful stats, 38 | - And much more.. 39 | 40 | ## 🐞 Found a Bug 41 | 42 | 43 | 44 | If you found any bugs, please open an issue 45 | or [contact me](http://mazahir26.github.io/) 46 | 47 | _The app has only been tested on Android._ 48 | ## 📝 License 49 | 50 | This project is licensed under the [MIT License](LICENSE.md). 51 | 52 | ## ❤️ Thank You 53 | 54 | Thanks for checking out my project, I would love to hear feedback, you can [contact](http://mazahir26.github.io/) me via Mail or Telegram. 55 | 56 | [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/mazahir) 57 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | # require_trailing_commas: true 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def keyStoreProperties= new Properties() 16 | def keyStorePropertiesFile = rootProject.file('key.properties') 17 | if (keyStorePropertiesFile.exists()) { 18 | keyStorePropertiesFile.withReader('UTF-8') {reader -> 19 | keyStoreProperties.load(reader) 20 | } 21 | } 22 | 23 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 24 | if (flutterVersionCode == null) { 25 | flutterVersionCode = '1' 26 | } 27 | 28 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 29 | if (flutterVersionName == null) { 30 | flutterVersionName = '1.0' 31 | } 32 | 33 | 34 | 35 | android { 36 | compileSdkVersion flutter.compileSdkVersion 37 | ndkVersion flutter.ndkVersion 38 | 39 | compileOptions { 40 | sourceCompatibility JavaVersion.VERSION_1_8 41 | targetCompatibility JavaVersion.VERSION_1_8 42 | } 43 | 44 | kotlinOptions { 45 | jvmTarget = '1.8' 46 | } 47 | 48 | sourceSets { 49 | main.java.srcDirs += 'src/main/kotlin' 50 | } 51 | 52 | defaultConfig { 53 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 54 | applicationId "com.example.koduko" 55 | // You can update the following values to match your application needs. 56 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 57 | minSdkVersion flutter.minSdkVersion 58 | targetSdkVersion flutter.targetSdkVersion 59 | versionCode flutterVersionCode.toInteger() 60 | versionName flutterVersionName 61 | } 62 | 63 | signingConfigs { 64 | release { 65 | storeFile file(keyStoreProperties['storeFile']) 66 | storePassword keyStoreProperties['storePassword'] 67 | keyAlias keyStoreProperties['keyAlias'] 68 | keyPassword keyStoreProperties['keyPassword'] 69 | v1SigningEnabled true 70 | v2SigningEnabled true 71 | enableV3Signing true 72 | enableV4Signing true 73 | } 74 | } 75 | 76 | buildTypes { 77 | release { 78 | signingConfig signingConfigs.release 79 | } 80 | } 81 | // buildTypes { 82 | // release { 83 | // // TODO: Add your own signing config for the release build. 84 | // // Signing with the debug keys for now, so `flutter run --release` works. 85 | // signingConfig signingConfigs.debug 86 | // shrinkResources false 87 | // } 88 | // } 89 | } 90 | 91 | flutter { 92 | source '../..' 93 | } 94 | 95 | dependencies { 96 | } 97 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/koduko/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.koduko 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi-v11/ic_stat_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-hdpi-v11/ic_stat_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-hdpi/app_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi-v11/ic_stat_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-mdpi-v11/ic_stat_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-mdpi/app_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi-v11/ic_stat_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-xhdpi-v11/ic_stat_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-xhdpi/app_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi-v11/ic_stat_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-xxhdpi-v11/ic_stat_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-xxhdpi/app_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable-xxxhdpi/app_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/drawable/app_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/mipmap-hdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/mipmap-mdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | } 7 | 8 | rootProject.buildDir = '../build' 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(':app') 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "7.2.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.7.20" apply false 23 | } 24 | 25 | include ":app" -------------------------------------------------------------------------------- /assets/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/assets/icon/icon.png -------------------------------------------------------------------------------- /assets/onboarding/gymGuy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/assets/onboarding/gymGuy.png -------------------------------------------------------------------------------- /assets/onboarding/gymPerson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/assets/onboarding/gymPerson.png -------------------------------------------------------------------------------- /assets/onboarding/gymTime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/assets/onboarding/gymTime.png -------------------------------------------------------------------------------- /assets/onboarding/person.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/assets/onboarding/person.png -------------------------------------------------------------------------------- /assets/onboarding/watch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/assets/onboarding/watch.png -------------------------------------------------------------------------------- /github_assets/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/github_assets/image1.png -------------------------------------------------------------------------------- /github_assets/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/github_assets/image2.png -------------------------------------------------------------------------------- /github_assets/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/github_assets/image3.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | if #available(iOS 10.0, *) { 11 | UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate 12 | } 13 | GeneratedPluginRegistrant.register(with: self) 14 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-20@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-20@2x~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-20~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-20~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29@2x~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-29~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-40@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-40@2x~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-40~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-40~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-60@2x~car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-60@2x~car.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-60@3x~car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-60@3x~car.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5@2x~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon@2x~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon~ios-marketing.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/AppIcon~ipad.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "filename": "AppIcon@2x.png", 5 | "idiom": "iphone", 6 | "scale": "2x", 7 | "size": "60x60" 8 | }, 9 | { 10 | "filename": "AppIcon@3x.png", 11 | "idiom": "iphone", 12 | "scale": "3x", 13 | "size": "60x60" 14 | }, 15 | { 16 | "filename": "AppIcon~ipad.png", 17 | "idiom": "ipad", 18 | "scale": "1x", 19 | "size": "76x76" 20 | }, 21 | { 22 | "filename": "AppIcon@2x~ipad.png", 23 | "idiom": "ipad", 24 | "scale": "2x", 25 | "size": "76x76" 26 | }, 27 | { 28 | "filename": "AppIcon-83.5@2x~ipad.png", 29 | "idiom": "ipad", 30 | "scale": "2x", 31 | "size": "83.5x83.5" 32 | }, 33 | { 34 | "filename": "AppIcon-40@2x.png", 35 | "idiom": "iphone", 36 | "scale": "2x", 37 | "size": "40x40" 38 | }, 39 | { 40 | "filename": "AppIcon-40@3x.png", 41 | "idiom": "iphone", 42 | "scale": "3x", 43 | "size": "40x40" 44 | }, 45 | { 46 | "filename": "AppIcon-40~ipad.png", 47 | "idiom": "ipad", 48 | "scale": "1x", 49 | "size": "40x40" 50 | }, 51 | { 52 | "filename": "AppIcon-40@2x~ipad.png", 53 | "idiom": "ipad", 54 | "scale": "2x", 55 | "size": "40x40" 56 | }, 57 | { 58 | "filename": "AppIcon-20@2x.png", 59 | "idiom": "iphone", 60 | "scale": "2x", 61 | "size": "20x20" 62 | }, 63 | { 64 | "filename": "AppIcon-20@3x.png", 65 | "idiom": "iphone", 66 | "scale": "3x", 67 | "size": "20x20" 68 | }, 69 | { 70 | "filename": "AppIcon-20~ipad.png", 71 | "idiom": "ipad", 72 | "scale": "1x", 73 | "size": "20x20" 74 | }, 75 | { 76 | "filename": "AppIcon-20@2x~ipad.png", 77 | "idiom": "ipad", 78 | "scale": "2x", 79 | "size": "20x20" 80 | }, 81 | { 82 | "filename": "AppIcon-29.png", 83 | "idiom": "iphone", 84 | "scale": "1x", 85 | "size": "29x29" 86 | }, 87 | { 88 | "filename": "AppIcon-29@2x.png", 89 | "idiom": "iphone", 90 | "scale": "2x", 91 | "size": "29x29" 92 | }, 93 | { 94 | "filename": "AppIcon-29@3x.png", 95 | "idiom": "iphone", 96 | "scale": "3x", 97 | "size": "29x29" 98 | }, 99 | { 100 | "filename": "AppIcon-29~ipad.png", 101 | "idiom": "ipad", 102 | "scale": "1x", 103 | "size": "29x29" 104 | }, 105 | { 106 | "filename": "AppIcon-29@2x~ipad.png", 107 | "idiom": "ipad", 108 | "scale": "2x", 109 | "size": "29x29" 110 | }, 111 | { 112 | "filename": "AppIcon-60@2x~car.png", 113 | "idiom": "car", 114 | "scale": "2x", 115 | "size": "60x60" 116 | }, 117 | { 118 | "filename": "AppIcon-60@3x~car.png", 119 | "idiom": "car", 120 | "scale": "3x", 121 | "size": "60x60" 122 | }, 123 | { 124 | "filename": "AppIcon~ios-marketing.png", 125 | "idiom": "ios-marketing", 126 | "scale": "1x", 127 | "size": "1024x1024" 128 | } 129 | ], 130 | "info": { 131 | "author": "iconkitchen", 132 | "version": 1 133 | } 134 | } -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Koduko 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | koduko 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/components/daily_activity.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:koduko/services/routines_provider.dart'; 3 | import 'package:percent_indicator/circular_percent_indicator.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | class TodayProgress extends StatelessWidget { 7 | const TodayProgress({ 8 | super.key, 9 | required this.textTheme, 10 | }); 11 | 12 | final TextTheme textTheme; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Card( 17 | margin: const EdgeInsets.symmetric(vertical: 10), 18 | child: Padding( 19 | padding: const EdgeInsets.symmetric(vertical: 15), 20 | child: Consumer(builder: ((context, value, child) { 21 | var inT = value.totalNoOfCompletedTasksToday(); 22 | var t = value.totalNoOfTasksToday(); 23 | double per; 24 | if (t == 0) { 25 | per = 0; 26 | } else { 27 | per = inT / t; 28 | } 29 | 30 | return Row( 31 | mainAxisAlignment: MainAxisAlignment.spaceAround, 32 | children: [ 33 | Column( 34 | crossAxisAlignment: CrossAxisAlignment.start, 35 | children: [ 36 | Text( 37 | '${value.totalNoOfCompletedTasksToday()}/${value.totalNoOfTasksToday()}', 38 | style: textTheme.headlineLarge, 39 | ), 40 | Text( 41 | "Today's Progress", 42 | style: textTheme.titleMedium, 43 | ) 44 | ], 45 | ), 46 | Stack( 47 | alignment: AlignmentDirectional.center, 48 | children: [ 49 | CircularPercentIndicator( 50 | percent: per, 51 | backgroundColor: 52 | Theme.of(context).colorScheme.surfaceContainerHighest, 53 | backgroundWidth: 15, 54 | progressColor: Theme.of(context).colorScheme.inversePrimary, 55 | animation: true, 56 | circularStrokeCap: CircularStrokeCap.round, 57 | radius: 40, 58 | lineWidth: 8, 59 | ), 60 | Text( 61 | '${(per * 100).toInt()}%', 62 | style: textTheme.titleSmall!.apply(fontWeightDelta: 1), 63 | ) 64 | ], 65 | ) 66 | ], 67 | ); 68 | })), 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/components/header.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ScreenHeader extends StatelessWidget { 4 | const ScreenHeader({super.key, required this.text, required this.tag}); 5 | final String text; 6 | final String tag; 7 | @override 8 | Widget build(BuildContext context) { 9 | return Row( 10 | children: [ 11 | Expanded( 12 | flex: 1, 13 | child: IconButton( 14 | onPressed: () { 15 | Navigator.pop(context); 16 | }, 17 | icon: const Icon( 18 | Icons.arrow_back_ios, 19 | size: 30, 20 | ), 21 | ), 22 | ), 23 | Expanded( 24 | flex: 10, 25 | child: Hero( 26 | tag: tag, 27 | child: Text( 28 | text, 29 | style: Theme.of(context) 30 | .textTheme 31 | .headlineLarge! 32 | .apply(color: Theme.of(context).colorScheme.onSurface), 33 | textAlign: TextAlign.center, 34 | ), 35 | ), 36 | ), 37 | ], 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/components/most_productive_hour.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:intl/intl.dart'; 3 | import 'package:koduko/services/routines_provider.dart'; 4 | import 'package:koduko/utils/time_of_day_util.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | class ProductiveHour extends StatelessWidget { 8 | const ProductiveHour({super.key, required this.textTheme}); 9 | final TextTheme textTheme; 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Card( 14 | child: Selector( 15 | selector: (p0, p1) => p1.getMostProductiveHour(), 16 | builder: (context, value, child) => Padding( 17 | padding: const EdgeInsets.all(8.0), 18 | child: Column( 19 | children: [ 20 | const SizedBox(height: 15), 21 | Text( 22 | "Most Productive Hour", 23 | style: textTheme.titleSmall, 24 | ), 25 | const SizedBox(height: 10), 26 | Text( 27 | DateFormat.j().format( 28 | timeOfDayToDateTime(TimeOfDay(hour: value, minute: 0)) ?? 29 | DateTime.now()), 30 | style: textTheme.headlineLarge, 31 | ), 32 | const SizedBox(height: 15), 33 | ], 34 | ), 35 | ), 36 | )); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/components/name_page_bottom_sheet.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class NamePage extends StatelessWidget { 4 | const NamePage( 5 | {super.key, 6 | required this.nameController, 7 | required this.validateName, 8 | required this.pageComplected, 9 | required this.hintText, 10 | required this.title}); 11 | final TextEditingController nameController; 12 | final void Function(String) validateName; 13 | final bool pageComplected; 14 | final String hintText; 15 | final String title; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Column( 20 | mainAxisAlignment: MainAxisAlignment.center, 21 | crossAxisAlignment: CrossAxisAlignment.start, 22 | children: [ 23 | Text( 24 | title, 25 | style: Theme.of(context).textTheme.titleLarge, 26 | ), 27 | const SizedBox( 28 | height: 25, 29 | ), 30 | TextField( 31 | controller: nameController, 32 | autofocus: true, 33 | maxLength: 20, 34 | onChanged: validateName, 35 | decoration: InputDecoration( 36 | suffixIcon: pageComplected ? const Icon(Icons.check) : null, 37 | filled: true, 38 | hintText: hintText, 39 | errorText: 40 | nameController.text.length > 2 || nameController.text.isEmpty 41 | ? null 42 | : "Invalid Name", 43 | ), 44 | ) 45 | ], 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/components/productive_day.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:intl/intl.dart'; 3 | import 'package:koduko/services/routines_provider.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | class ProductiveDay extends StatelessWidget { 7 | const ProductiveDay({super.key, required this.textTheme}); 8 | final TextTheme textTheme; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Card( 13 | child: Selector( 14 | selector: (p0, p1) => p1.getMostProductiveDay(), 15 | builder: (context, value, child) => Padding( 16 | padding: const EdgeInsets.all(8.0), 17 | child: Column( 18 | children: [ 19 | const SizedBox(height: 15), 20 | Text( 21 | "Most Productive Day", 22 | style: textTheme.titleSmall, 23 | ), 24 | const SizedBox(height: 10), 25 | Text( 26 | value == null ? 'NaN' : DateFormat('EEEE').format(value), 27 | style: textTheme.headlineLarge, 28 | ), 29 | const SizedBox(height: 15), 30 | ], 31 | ), 32 | ), 33 | )); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/components/routine_chart.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:fl_chart/fl_chart.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:intl/intl.dart'; 6 | import 'package:koduko/models/routine.dart'; 7 | import 'package:koduko/services/routines_provider.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class RoutineChart extends StatelessWidget { 11 | const RoutineChart({super.key, required this.routine}); 12 | 13 | // final List gradientColors = [ 14 | // const Color(0xff6f7bf7), 15 | // const Color(0xff9bf8f4), 16 | // ]; 17 | final Routine routine; 18 | @override 19 | Widget build(BuildContext context) { 20 | return Consumer(builder: (context, value, child) { 21 | double maxX = 22 | value.getRoutineStartMaxDays(routine.id).toDouble().clamp(0, 7); 23 | double maxY = value.getRoutineStats(routine.id).isNotEmpty 24 | ? value.getRoutineStats(routine.id).reduce(max).toDouble() 25 | : 10; 26 | Color c = Theme.of(context).brightness == Brightness.light 27 | ? Colors.black12 28 | : Colors.grey[800]!; 29 | 30 | final showChart = maxX >= 1 ? true : false; 31 | 32 | if (!showChart) { 33 | return Padding( 34 | padding: const EdgeInsets.all(15), 35 | child: Text( 36 | "${routine.name.trim()}'s activity will show up here. ", 37 | style: Theme.of(context).textTheme.bodyLarge, 38 | textAlign: TextAlign.center, 39 | ), 40 | ); 41 | } 42 | return Column( 43 | children: [ 44 | const SizedBox(height: 10), 45 | Padding( 46 | padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5), 47 | child: Align( 48 | alignment: Alignment.centerLeft, 49 | child: Text( 50 | "${routine.name.trim()}'s Activity", 51 | style: Theme.of(context).textTheme.titleLarge, 52 | ), 53 | ), 54 | ), 55 | Padding( 56 | padding: const EdgeInsets.symmetric( 57 | horizontal: 15, 58 | ), 59 | child: SizedBox( 60 | height: 200, 61 | child: Padding( 62 | padding: const EdgeInsets.all(10.0), 63 | child: LineChart( 64 | LineChartData( 65 | titlesData: FlTitlesData( 66 | show: true, 67 | rightTitles: const AxisTitles( 68 | sideTitles: SideTitles(showTitles: false), 69 | ), 70 | topTitles: const AxisTitles( 71 | sideTitles: SideTitles(showTitles: false), 72 | ), 73 | bottomTitles: AxisTitles( 74 | sideTitles: SideTitles( 75 | showTitles: true, 76 | reservedSize: 30, 77 | interval: 1, 78 | getTitlesWidget: ((v, meta) => bottomTitleWidgets( 79 | v, c, meta, value.getStartDate(routine.id))), 80 | ), 81 | ), 82 | leftTitles: AxisTitles( 83 | sideTitles: SideTitles( 84 | showTitles: false, 85 | reservedSize: 30, 86 | interval: 1, 87 | getTitlesWidget: ((v, meta) => 88 | leftTitleWidgets(v, c, meta)), 89 | ), 90 | ), 91 | ), 92 | gridData: FlGridData( 93 | show: true, 94 | drawVerticalLine: true, 95 | horizontalInterval: 1, 96 | verticalInterval: 1, 97 | getDrawingHorizontalLine: (value) { 98 | return FlLine( 99 | color: c, 100 | strokeWidth: 1, 101 | ); 102 | }, 103 | getDrawingVerticalLine: (value) { 104 | return FlLine( 105 | color: c, 106 | strokeWidth: 1, 107 | ); 108 | }, 109 | ), 110 | borderData: FlBorderData( 111 | show: true, border: Border.all(color: c, width: 1)), 112 | minX: 0, 113 | maxX: maxX, 114 | minY: -0.2, 115 | maxY: maxY + 1, 116 | lineBarsData: [ 117 | LineChartBarData( 118 | spots: value 119 | .getRoutineStats(routine.id) 120 | .asMap() 121 | .map((key, value) => MapEntry( 122 | key, FlSpot(key.toDouble(), value.toDouble()))) 123 | .values 124 | .toList(), 125 | isCurved: true, 126 | curveSmoothness: 0.5, 127 | barWidth: 3, 128 | color: Theme.of(context).colorScheme.primary, 129 | dotData: const FlDotData( 130 | show: true, 131 | ), 132 | belowBarData: BarAreaData( 133 | show: true, 134 | color: Theme.of(context) 135 | .colorScheme 136 | .primary 137 | .withOpacity(0.4), 138 | ), 139 | ), 140 | ], 141 | ), 142 | ), 143 | ), 144 | ), 145 | ), 146 | ], 147 | ); 148 | }); 149 | } 150 | } 151 | 152 | Widget bottomTitleWidgets( 153 | double value, Color c, TitleMeta meta, DateTime start) { 154 | final style = TextStyle( 155 | color: c, 156 | fontWeight: FontWeight.bold, 157 | fontSize: 12, 158 | ); 159 | 160 | return SideTitleWidget( 161 | axisSide: meta.axisSide, 162 | space: 8.0, 163 | child: Text( 164 | DateFormat('dd/MM').format(start.add(Duration(days: value.toInt()))), 165 | style: style), 166 | ); 167 | } 168 | 169 | Widget leftTitleWidgets(double value, Color c, TitleMeta meta) { 170 | final style = TextStyle( 171 | color: c, 172 | fontWeight: FontWeight.bold, 173 | fontSize: 12, 174 | ); 175 | if (value < 0) { 176 | return Container(); 177 | } 178 | return Text( 179 | value.toInt().toString(), 180 | style: style, 181 | textAlign: TextAlign.center, 182 | ); 183 | } 184 | -------------------------------------------------------------------------------- /lib/components/task_tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:koduko/components/create_task_bottom_sheet.dart'; 3 | import 'package:koduko/models/task.dart'; 4 | import 'package:koduko/services/routines_provider.dart'; 5 | import 'package:koduko/services/tasks_provider.dart'; 6 | import 'package:koduko/utils/duration_to_string.dart'; 7 | import 'package:koduko/utils/parse_duration.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class TaskTile extends StatelessWidget { 11 | const TaskTile({super.key, required this.task, required this.onEdit}); 12 | final Task task; 13 | final void Function(Task) onEdit; 14 | @override 15 | Widget build(BuildContext context) { 16 | return Card( 17 | child: ListTile( 18 | trailing: SizedBox( 19 | width: 100, 20 | child: Row( 21 | mainAxisAlignment: MainAxisAlignment.center, 22 | children: [ 23 | IconButton( 24 | onPressed: () async { 25 | Task? t = await showModalBottomSheet( 26 | isScrollControlled: true, 27 | isDismissible: true, 28 | shape: const RoundedRectangleBorder( 29 | borderRadius: BorderRadius.vertical( 30 | top: Radius.circular(10), 31 | bottom: Radius.zero, 32 | ), 33 | ), 34 | context: context, 35 | builder: ((context) => CreateTaskBottomSheet( 36 | task: task, 37 | ))); 38 | 39 | if (t != null) { 40 | onEdit(task.copyWith( 41 | color: t.color, duration: t.duration, name: t.name)); 42 | } 43 | }, 44 | icon: const Icon(Icons.edit)), 45 | IconButton( 46 | onPressed: () async { 47 | showDialog( 48 | context: context, 49 | builder: ((context) => AlertDialog( 50 | title: const Text("Delete task?"), 51 | content: const Text( 52 | "This Task will be removed from all the routines. if the routine has only this task, then routine will also be deleted."), 53 | actions: [ 54 | TextButton( 55 | onPressed: () { 56 | Navigator.pop(context); 57 | }, 58 | child: const Text("CANCEL"), 59 | ), 60 | TextButton( 61 | style: TextButton.styleFrom( 62 | foregroundColor: 63 | Theme.of(context).colorScheme.error), 64 | onPressed: () { 65 | Provider.of(context, 66 | listen: false) 67 | .delete(task.id); 68 | Provider.of(context, 69 | listen: false) 70 | .removeTask(task); 71 | Navigator.pop(context); 72 | }, 73 | child: const Text("DELETE"), 74 | ) 75 | ], 76 | ))); 77 | }, 78 | icon: Icon( 79 | Icons.delete, 80 | color: Colors.red[300], 81 | )) 82 | ], 83 | ), 84 | ), 85 | subtitle: Text( 86 | 'Duration : ${durationToString(parseDuration(task.duration))} Min'), 87 | title: Text( 88 | task.name, 89 | style: Theme.of(context).textTheme.bodyMedium, 90 | ), 91 | ), 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/components/time_spent_today.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:koduko/services/routines_provider.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | class TimeSpentToday extends StatelessWidget { 6 | const TimeSpentToday({super.key, required this.textTheme}); 7 | final TextTheme textTheme; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Card( 12 | child: Selector( 13 | selector: (p0, p1) => p1.getTimeSpentToday(), 14 | builder: (context, value, child) => Padding( 15 | padding: const EdgeInsets.all(8.0), 16 | child: Column( 17 | children: [ 18 | const SizedBox(height: 15), 19 | Text( 20 | "Time Spent Today", 21 | style: textTheme.titleSmall, 22 | ), 23 | const SizedBox(height: 10), 24 | Text( 25 | "$value mins", 26 | style: textTheme.headlineLarge, 27 | ), 28 | const SizedBox(height: 15), 29 | ], 30 | ), 31 | ), 32 | )); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_native_timezone/flutter_native_timezone.dart'; 3 | import 'package:hive_flutter/hive_flutter.dart'; 4 | import 'package:koduko/models/routine.dart'; 5 | import 'package:koduko/models/task.dart'; 6 | import 'package:koduko/models/task_event.dart'; 7 | import 'package:koduko/screens/about.dart'; 8 | import 'package:koduko/screens/app.dart'; 9 | import 'package:koduko/screens/archive_routines.dart'; 10 | import 'package:koduko/screens/onboarding.dart'; 11 | import 'package:koduko/screens/stats.dart'; 12 | import 'package:koduko/screens/tasks.dart'; 13 | import 'package:koduko/services/notification_service.dart'; 14 | import 'package:koduko/services/routines_provider.dart'; 15 | import 'package:koduko/services/tasks_provider.dart'; 16 | import 'package:koduko/services/theme_provider.dart'; 17 | import 'package:provider/provider.dart'; 18 | import 'package:timezone/data/latest_all.dart' as tz; 19 | import 'package:timezone/timezone.dart' as tz; 20 | 21 | void main() async { 22 | await Hive.initFlutter(); 23 | Hive.registerAdapter(TaskAdapter()); 24 | Hive.registerAdapter(RoutineAdapter()); 25 | Hive.registerAdapter(TaskEventAdapter()); 26 | WidgetsFlutterBinding.ensureInitialized(); 27 | 28 | await NotificationService().initialize(); 29 | _configureLocalTimeZone(); 30 | runApp(const MyApp()); 31 | } 32 | 33 | Future _configureLocalTimeZone() async { 34 | tz.initializeTimeZones(); 35 | final String timeZoneName = await FlutterNativeTimezone.getLocalTimezone(); 36 | tz.setLocalLocation(tz.getLocation(timeZoneName)); 37 | } 38 | 39 | class MyApp extends StatelessWidget { 40 | const MyApp({super.key}); 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | return FutureBuilder( 45 | future: Future.wait([ 46 | Hive.openBox("Routines"), 47 | Hive.openBox("Tasks"), 48 | Hive.openBox("Theme"), 49 | ]), 50 | builder: (context, snapshot) { 51 | if (snapshot.hasError) { 52 | return MaterialApp( 53 | debugShowCheckedModeBanner: false, 54 | home: Scaffold( 55 | body: Center( 56 | child: Text( 57 | "Oops! Try again later", 58 | style: Theme.of(context).textTheme.displayMedium, 59 | ), 60 | ), 61 | ), 62 | ); 63 | } else if (snapshot.hasData) { 64 | final box = Hive.box('Theme'); 65 | String initRoute = '/'; 66 | if (box.isOpen) { 67 | initRoute = 68 | (box.get('isNewUser') ?? true) ? OnBoarding.routeName : '/'; 69 | } 70 | return MultiProvider( 71 | providers: [ 72 | ChangeNotifierProvider( 73 | create: (context) => RoutineModel(), 74 | ), 75 | ChangeNotifierProvider( 76 | create: (context) => TaskModel(), 77 | ), 78 | ChangeNotifierProvider( 79 | create: ((context) => ThemeModel()), 80 | ), 81 | ], 82 | child: Consumer( 83 | builder: (context, value, child) => MaterialApp( 84 | debugShowCheckedModeBanner: false, 85 | title: 'KudoKo', 86 | themeMode: value.getTheme, 87 | theme: ThemeData.light(useMaterial3: true).copyWith( 88 | colorScheme: ColorScheme.fromSeed( 89 | seedColor: Colors.purple, 90 | brightness: Brightness.light, 91 | ), 92 | ), 93 | darkTheme: ThemeData.dark(useMaterial3: true).copyWith( 94 | colorScheme: ColorScheme.fromSeed( 95 | seedColor: Colors.purple, 96 | brightness: Brightness.dark, 97 | ), 98 | ), 99 | initialRoute: initRoute, 100 | routes: { 101 | TasksScreen.routeName: (context) => const TasksScreen(), 102 | App.routeName: (context) => const App(), 103 | AboutScreen.routeName: (context) => const AboutScreen(), 104 | Statistics.routeName: ((context) => const Statistics()), 105 | ArchiveRoutinesScreen.routeName: ((context) => 106 | const ArchiveRoutinesScreen()), 107 | OnBoarding.routeName: (((context) => const OnBoarding())) 108 | }), 109 | ), 110 | ); 111 | } 112 | return const MaterialApp( 113 | home: Scaffold( 114 | body: Center( 115 | child: SizedBox( 116 | height: 60, 117 | width: 60, 118 | child: CircularProgressIndicator( 119 | strokeWidth: 6, 120 | ), 121 | ), 122 | )), 123 | ); 124 | }, 125 | ); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /lib/models/routine.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'routine.dart'; 4 | 5 | // ************************************************************************** 6 | // TypeAdapterGenerator 7 | // ************************************************************************** 8 | 9 | class RoutineAdapter extends TypeAdapter { 10 | @override 11 | final int typeId = 2; 12 | 13 | @override 14 | Routine read(BinaryReader reader) { 15 | final numOfFields = reader.readByte(); 16 | final fields = { 17 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 18 | }; 19 | return Routine( 20 | name: fields[1] as String, 21 | tasks: (fields[2] as List).cast(), 22 | inCompletedTasks: (fields[3] as List).cast(), 23 | history: (fields[4] as List).cast(), 24 | id: fields[0] as String, 25 | days: (fields[6] as List).cast(), 26 | isCompleted: fields[5] == null ? true : fields[5] as bool, 27 | time: fields[7] as DateTime?, 28 | isArchive: fields[8] == null ? false : fields[8] as bool, 29 | ); 30 | } 31 | 32 | @override 33 | void write(BinaryWriter writer, Routine obj) { 34 | writer 35 | ..writeByte(9) 36 | ..writeByte(0) 37 | ..write(obj.id) 38 | ..writeByte(1) 39 | ..write(obj.name) 40 | ..writeByte(2) 41 | ..write(obj.tasks) 42 | ..writeByte(3) 43 | ..write(obj.inCompletedTasks) 44 | ..writeByte(4) 45 | ..write(obj.history) 46 | ..writeByte(5) 47 | ..write(obj.isCompleted) 48 | ..writeByte(6) 49 | ..write(obj.days) 50 | ..writeByte(7) 51 | ..write(obj.time) 52 | ..writeByte(8) 53 | ..write(obj.isArchive); 54 | } 55 | 56 | @override 57 | int get hashCode => typeId.hashCode; 58 | 59 | @override 60 | bool operator ==(Object other) => 61 | identical(this, other) || 62 | other is RoutineAdapter && 63 | runtimeType == other.runtimeType && 64 | typeId == other.typeId; 65 | } 66 | -------------------------------------------------------------------------------- /lib/models/task.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hive/hive.dart'; 3 | import 'package:uuid/uuid.dart'; 4 | part 'task.g.dart'; 5 | 6 | @HiveType(typeId: 1) 7 | class Task { 8 | @HiveField(0) 9 | late String id; 10 | 11 | @HiveField(1) 12 | String name; 13 | 14 | @HiveField(2) 15 | late String duration; 16 | 17 | @HiveField(3) 18 | late int color; 19 | 20 | Task( 21 | {required this.duration, 22 | required this.name, 23 | required this.color, 24 | required this.id}); 25 | 26 | Task copyWith({ 27 | String? duration, 28 | String? name, 29 | int? color, 30 | String? id, 31 | }) { 32 | return Task( 33 | duration: duration ?? this.duration, 34 | name: name ?? this.name, 35 | color: color ?? this.color, 36 | id: id ?? this.id); 37 | } 38 | 39 | Task.fromDuration( 40 | {required Duration duration, required this.name, required Color color}) { 41 | this.duration = duration.toString(); 42 | this.color = color.value; 43 | id = const Uuid().v4(); 44 | } 45 | @override 46 | String toString() { 47 | super.toString(); 48 | return '{id: $id ,name: $name, color: $color, duration: $duration}'; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/models/task.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'task.dart'; 4 | 5 | // ************************************************************************** 6 | // TypeAdapterGenerator 7 | // ************************************************************************** 8 | 9 | class TaskAdapter extends TypeAdapter { 10 | @override 11 | final int typeId = 1; 12 | 13 | @override 14 | Task read(BinaryReader reader) { 15 | final numOfFields = reader.readByte(); 16 | final fields = { 17 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 18 | }; 19 | return Task( 20 | duration: fields[2] as String, 21 | name: fields[1] as String, 22 | color: fields[3] as int, 23 | id: fields[0] as String, 24 | ); 25 | } 26 | 27 | @override 28 | void write(BinaryWriter writer, Task obj) { 29 | writer 30 | ..writeByte(4) 31 | ..writeByte(0) 32 | ..write(obj.id) 33 | ..writeByte(1) 34 | ..write(obj.name) 35 | ..writeByte(2) 36 | ..write(obj.duration) 37 | ..writeByte(3) 38 | ..write(obj.color); 39 | } 40 | 41 | @override 42 | int get hashCode => typeId.hashCode; 43 | 44 | @override 45 | bool operator ==(Object other) => 46 | identical(this, other) || 47 | other is TaskAdapter && 48 | runtimeType == other.runtimeType && 49 | typeId == other.typeId; 50 | } 51 | -------------------------------------------------------------------------------- /lib/models/task_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive_flutter/adapters.dart'; 2 | import 'package:uuid/uuid.dart'; 3 | 4 | part 'task_event.g.dart'; 5 | 6 | @HiveType(typeId: 3) 7 | class TaskEvent { 8 | @HiveField(0) 9 | late final String id; 10 | 11 | @HiveField(1) 12 | final String taskName; 13 | 14 | @HiveField(2) 15 | final DateTime time; 16 | 17 | @HiveField(3) 18 | final String taskId; 19 | 20 | TaskEvent({ 21 | required this.id, 22 | required this.taskName, 23 | required this.time, 24 | required this.taskId, 25 | }); 26 | 27 | @override 28 | String toString() { 29 | return '[Id : $id, Name: $taskName, Time: $time, TaskId: $taskId]'; 30 | } 31 | 32 | TaskEvent.create({ 33 | required this.taskName, 34 | required this.taskId, 35 | required this.time, 36 | }) { 37 | id = const Uuid().v4(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/models/task_event.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'task_event.dart'; 4 | 5 | // ************************************************************************** 6 | // TypeAdapterGenerator 7 | // ************************************************************************** 8 | 9 | class TaskEventAdapter extends TypeAdapter { 10 | @override 11 | final int typeId = 3; 12 | 13 | @override 14 | TaskEvent read(BinaryReader reader) { 15 | final numOfFields = reader.readByte(); 16 | final fields = { 17 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 18 | }; 19 | return TaskEvent( 20 | id: fields[0] as String, 21 | taskName: fields[1] as String, 22 | time: fields[2] as DateTime, 23 | taskId: fields[3] as String, 24 | ); 25 | } 26 | 27 | @override 28 | void write(BinaryWriter writer, TaskEvent obj) { 29 | writer 30 | ..writeByte(4) 31 | ..writeByte(0) 32 | ..write(obj.id) 33 | ..writeByte(1) 34 | ..write(obj.taskName) 35 | ..writeByte(2) 36 | ..write(obj.time) 37 | ..writeByte(3) 38 | ..write(obj.taskId); 39 | } 40 | 41 | @override 42 | int get hashCode => typeId.hashCode; 43 | 44 | @override 45 | bool operator ==(Object other) => 46 | identical(this, other) || 47 | other is TaskEventAdapter && 48 | runtimeType == other.runtimeType && 49 | typeId == other.typeId; 50 | } 51 | -------------------------------------------------------------------------------- /lib/screens/about.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:koduko/components/header.dart'; 4 | import 'package:url_launcher/url_launcher.dart'; 5 | 6 | class AboutScreen extends StatelessWidget { 7 | const AboutScreen({super.key}); 8 | static const routeName = "/about"; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | Future openUrl(url) async { 13 | if (!await launchUrl(url, mode: LaunchMode.externalApplication)) { 14 | throw 'Could not launch $url'; 15 | } 16 | } 17 | 18 | return Scaffold( 19 | body: SafeArea( 20 | child: Padding( 21 | padding: const EdgeInsets.symmetric(horizontal: 10), 22 | child: Column( 23 | crossAxisAlignment: CrossAxisAlignment.start, 24 | children: [ 25 | const SizedBox(height: 25), 26 | const ScreenHeader( 27 | text: "About", 28 | tag: "About", 29 | ), 30 | const SizedBox(height: 25), 31 | Padding( 32 | padding: const EdgeInsets.all(15), 33 | child: Column( 34 | crossAxisAlignment: CrossAxisAlignment.start, 35 | children: [ 36 | RichText( 37 | text: TextSpan( 38 | text: 39 | "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 ", 40 | style: Theme.of(context).textTheme.bodyLarge, 41 | children: [ 42 | TextSpan( 43 | text: "here", 44 | recognizer: TapGestureRecognizer() 45 | ..onTap = () => openUrl(Uri.parse( 46 | 'https://github.com/Mazahir26/koduko')), 47 | style: Theme.of(context) 48 | .textTheme 49 | .bodyLarge! 50 | .copyWith( 51 | color: 52 | Theme.of(context).colorScheme.primary, 53 | ), 54 | ) 55 | ]), 56 | ), 57 | const SizedBox(height: 15), 58 | Text( 59 | 'Developer Contact', 60 | style: Theme.of(context) 61 | .textTheme 62 | .headlineMedium! 63 | .copyWith(fontWeight: FontWeight.bold), 64 | ), 65 | const SizedBox(height: 10), 66 | Text( 67 | "For any questions or suggestions regarding Koduko's functionality or code, You can reach me out via telegram or github", 68 | style: Theme.of(context).textTheme.bodyLarge, 69 | ), 70 | const SizedBox(height: 10), 71 | Row( 72 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 73 | children: [ 74 | TextButton( 75 | onPressed: () { 76 | openUrl( 77 | Uri.parse('https://github.com/Mazahir26')); 78 | }, 79 | child: const Text("GitHub")), 80 | TextButton( 81 | onPressed: () { 82 | openUrl(Uri.parse('https://t.me/mazahir26')); 83 | }, 84 | child: const Text("Telegram")) 85 | ], 86 | ), 87 | const SizedBox(height: 30), 88 | Center( 89 | child: Text( 90 | "Thank You ❤️", 91 | style: Theme.of(context) 92 | .textTheme 93 | .headlineMedium! 94 | .copyWith(fontWeight: FontWeight.bold), 95 | ), 96 | ), 97 | ], 98 | ), 99 | ) 100 | ], 101 | ), 102 | ), 103 | ), 104 | ); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /lib/screens/app.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:flutter_local_notifications/flutter_local_notifications.dart'; 6 | import 'package:koduko/screens/home.dart'; 7 | import 'package:koduko/screens/routines.dart'; 8 | import 'package:koduko/screens/settings.dart'; 9 | import 'package:koduko/screens/start_routine.dart'; 10 | import 'package:koduko/screens/tasks.dart'; 11 | import 'package:koduko/services/notification_service.dart'; 12 | 13 | class App extends StatefulWidget { 14 | const App({super.key}); 15 | static const routeName = "/"; 16 | 17 | @override 18 | State createState() => _AppState(); 19 | } 20 | 21 | class _AppState extends State { 22 | int _selectedIndex = 0; 23 | late final NotificationService service; 24 | late final StreamSubscription stream; 25 | NotificationAppLaunchDetails? notificationAppLaunchDetails; 26 | late final PageController _pageController; 27 | 28 | getDeviceLaunch() async { 29 | notificationAppLaunchDetails = await service.getDeviceLaunchInfo(); 30 | if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) { 31 | if ((notificationAppLaunchDetails! 32 | .notificationResponse?.payload?.isNotEmpty ?? 33 | false)) { 34 | onNotificationListener( 35 | notificationAppLaunchDetails!.notificationResponse?.payload); 36 | } 37 | } 38 | } 39 | 40 | void _onItemTapped(int index) { 41 | setState(() { 42 | _pageController.animateToPage( 43 | index, 44 | duration: const Duration(milliseconds: 250), 45 | curve: Curves.easeInOutCirc, 46 | ); 47 | _selectedIndex = index; 48 | }); 49 | } 50 | 51 | @override 52 | void initState() { 53 | service = NotificationService(); 54 | getDeviceLaunch(); 55 | _pageController = PageController(); 56 | stream = service.onNotificationClick.stream.listen(onNotificationListener); 57 | super.initState(); 58 | } 59 | 60 | @override 61 | void dispose() { 62 | stream.cancel(); 63 | super.dispose(); 64 | } 65 | 66 | @override 67 | Widget build(BuildContext context) { 68 | final List widgetOptions = [ 69 | HomeScreen( 70 | onTapChange: () => _onItemTapped(1), 71 | ), 72 | const RoutinesScreen(), 73 | const TasksScreen(isBottomNavWidget: true), 74 | const SettingsScreen(), 75 | ]; 76 | return AnnotatedRegion( 77 | value: SystemUiOverlayStyle( 78 | statusBarColor: Colors.transparent, 79 | systemNavigationBarColor: 80 | Theme.of(context).brightness == Brightness.dark 81 | ? Colors.black 82 | : Colors.white, 83 | statusBarIconBrightness: Theme.of(context).brightness == Brightness.dark 84 | ? Brightness.light 85 | : Brightness.dark, 86 | systemNavigationBarIconBrightness: 87 | Theme.of(context).brightness == Brightness.dark 88 | ? Brightness.light 89 | : Brightness.dark, 90 | ), 91 | child: Scaffold( 92 | bottomNavigationBar: NavigationBar( 93 | onDestinationSelected: _onItemTapped, 94 | labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected, 95 | selectedIndex: _selectedIndex, 96 | destinations: const [ 97 | NavigationDestination( 98 | selectedIcon: Icon(Icons.home_rounded), 99 | icon: Icon(Icons.home_outlined), 100 | label: 'Home', 101 | ), 102 | NavigationDestination( 103 | selectedIcon: Icon(Icons.task_alt_rounded), 104 | icon: Icon(Icons.task_alt_outlined), 105 | label: 'Routines', 106 | ), 107 | NavigationDestination( 108 | selectedIcon: Icon(Icons.list_rounded), 109 | icon: Icon(Icons.list_outlined), 110 | label: 'Tasks', 111 | ), 112 | NavigationDestination( 113 | selectedIcon: Icon(Icons.settings_rounded), 114 | icon: Icon(Icons.settings_outlined), 115 | label: 'Settings', 116 | ), 117 | ], 118 | ), 119 | body: SafeArea( 120 | child: PageView( 121 | controller: _pageController, 122 | onPageChanged: (value) => setState(() { 123 | _selectedIndex = value; 124 | }), 125 | children: widgetOptions, 126 | ), 127 | ), 128 | ), 129 | ); 130 | } 131 | 132 | void onNotificationListener(String? payload) { 133 | if (payload != null && payload.isNotEmpty) { 134 | Navigator.push( 135 | context, 136 | MaterialPageRoute( 137 | builder: ((context) => RoutineScreen( 138 | routine: payload, 139 | )))); 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /lib/screens/archive_routines.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_slidable/flutter_slidable.dart'; 3 | import 'package:koduko/components/header.dart'; 4 | import 'package:koduko/services/routines_provider.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | class ArchiveRoutinesScreen extends StatelessWidget { 8 | const ArchiveRoutinesScreen({super.key}); 9 | static const routeName = "/archive"; 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Scaffold( 14 | body: SafeArea( 15 | child: Consumer( 16 | builder: (context, value, child) => value.archiveRoutines().isEmpty 17 | ? Padding( 18 | padding: 19 | const EdgeInsets.symmetric(vertical: 20, horizontal: 10), 20 | child: Column( 21 | crossAxisAlignment: CrossAxisAlignment.start, 22 | children: [ 23 | child ?? Container(), 24 | Expanded( 25 | flex: 10, 26 | child: Center( 27 | child: Text( 28 | "Archived routines will show up here!", 29 | textAlign: TextAlign.center, 30 | style: Theme.of(context) 31 | .textTheme 32 | .apply( 33 | displayColor: 34 | Theme.of(context).colorScheme.onSurface) 35 | .headlineMedium, 36 | ), 37 | ), 38 | ), 39 | ], 40 | ), 41 | ) 42 | : ListView.builder( 43 | itemCount: value.archiveRoutines().length + 1, 44 | itemBuilder: (context, index) { 45 | if (index == 0) { 46 | return Padding( 47 | padding: const EdgeInsets.symmetric( 48 | vertical: 20, horizontal: 10), 49 | child: child ?? Container(), 50 | ); 51 | } 52 | index -= 1; 53 | return Card( 54 | margin: const EdgeInsets.all(10), 55 | child: ListTile( 56 | title: Text( 57 | value.archiveRoutines()[index].name, 58 | style: Theme.of(context).textTheme.titleLarge, 59 | ), 60 | subtitle: const Text("Archived"), 61 | trailing: SizedBox( 62 | width: 100, 63 | child: Row( 64 | children: [ 65 | IconButton( 66 | color: Colors.brown[300], 67 | onPressed: () { 68 | Provider.of(context, 69 | listen: false) 70 | .removeFromArchive( 71 | value.archiveRoutines()[index].id); 72 | }, 73 | icon: const Icon(Icons.unarchive_rounded), 74 | ), 75 | IconButton( 76 | color: Colors.red[300], 77 | onPressed: () {}, 78 | icon: const Icon(Icons.delete), 79 | ) 80 | ], 81 | ), 82 | ), 83 | ), 84 | ); 85 | }), 86 | child: const ScreenHeader(text: 'Archived', tag: 'Archived'), 87 | ), 88 | ), 89 | ); 90 | } 91 | } 92 | 93 | class Action extends StatelessWidget { 94 | const Action( 95 | {super.key, 96 | required this.onPress, 97 | required this.color, 98 | required this.icon, 99 | required this.label}); 100 | 101 | final Function(BuildContext context) onPress; 102 | final Color color; 103 | final IconData icon; 104 | final String label; 105 | @override 106 | Widget build(BuildContext context) { 107 | return Expanded( 108 | child: Padding( 109 | padding: const EdgeInsets.symmetric(horizontal: 10), 110 | child: Center( 111 | child: TextButton.icon( 112 | onPressed: (() { 113 | onPress(context); 114 | Slidable.of(context)?.close(); 115 | }), 116 | icon: Icon( 117 | icon, 118 | color: color, 119 | ), 120 | label: Text( 121 | label, 122 | style: Theme.of(context).textTheme.titleMedium!.apply(color: color), 123 | ), 124 | )), 125 | ), 126 | ); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /lib/screens/stats.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:intl/intl.dart'; 3 | import 'package:koduko/components/daily_activity.dart'; 4 | import 'package:koduko/components/header.dart'; 5 | import 'package:koduko/components/most_productive_hour.dart'; 6 | import 'package:koduko/components/productive_day.dart'; 7 | import 'package:koduko/components/time_spent_today.dart'; 8 | import 'package:koduko/components/weekly_chart.dart'; 9 | import 'package:koduko/models/task_event.dart'; 10 | import 'package:koduko/services/routines_provider.dart'; 11 | import 'package:provider/provider.dart'; 12 | 13 | class Statistics extends StatelessWidget { 14 | const Statistics({super.key}); 15 | static const routeName = "/stats"; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | void clearHistory() { 20 | Provider.of(context, listen: false).clearHistory(); 21 | } 22 | 23 | final textTheme = Theme.of(context).textTheme.apply( 24 | displayColor: Theme.of(context).colorScheme.onSurface, 25 | ); 26 | return Scaffold( 27 | body: Padding( 28 | padding: const EdgeInsets.all(15.0), 29 | child: ListView( 30 | children: [ 31 | const SizedBox(height: 10), 32 | const ScreenHeader(text: "Statistics", tag: "Statistics"), 33 | const SizedBox(height: 25), 34 | TodayProgress(textTheme: textTheme), 35 | Hero(tag: 'WeeklyChart', child: WeeklyChart(textTheme: textTheme)), 36 | const SizedBox(height: 10), 37 | Row( 38 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 39 | children: [ 40 | Expanded(child: ProductiveHour(textTheme: textTheme)), 41 | Expanded(child: ProductiveDay(textTheme: textTheme)), 42 | ], 43 | ), 44 | const SizedBox(height: 10), 45 | Row( 46 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 47 | children: [ 48 | Expanded(child: TimeSpentToday(textTheme: textTheme)), 49 | ], 50 | ), 51 | const SizedBox(height: 15), 52 | Row( 53 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 54 | children: [ 55 | Text( 56 | "History", 57 | style: textTheme.headlineMedium, 58 | ), 59 | TextButton.icon( 60 | onPressed: () async { 61 | final b = await showDialog( 62 | context: context, 63 | builder: ((context) => AlertDialog( 64 | title: const Text("Clear History"), 65 | content: const Text( 66 | "This is an irreversible action. This will delete all your stats."), 67 | actions: [ 68 | TextButton( 69 | onPressed: (() => 70 | Navigator.pop(context, false)), 71 | child: const Text("CANCEL"), 72 | ), 73 | TextButton( 74 | style: TextButton.styleFrom( 75 | foregroundColor: 76 | Theme.of(context).colorScheme.error), 77 | onPressed: (() => 78 | Navigator.pop(context, true)), 79 | child: const Text("DELETE"), 80 | ) 81 | ], 82 | )), 83 | ); 84 | if (b == true) { 85 | clearHistory(); 86 | } 87 | }, 88 | style: 89 | TextButton.styleFrom(foregroundColor: Colors.red[300]), 90 | icon: const Icon(Icons.delete), 91 | label: const Text("Clear History")) 92 | ], 93 | ), 94 | const SizedBox(height: 15), 95 | Selector>( 96 | builder: ((context, value, child) => Column( 97 | children: value.reversed 98 | .map((e) => Card( 99 | child: ListTile( 100 | trailing: IconButton( 101 | onPressed: () => Provider.of( 102 | context, 103 | listen: false) 104 | .removeHistory(e.id), 105 | color: Colors.red[300], 106 | icon: const Icon(Icons.close, 107 | semanticLabel: 'Delete'), 108 | ), 109 | // onTap: () => , 110 | title: Text(e.taskName), 111 | subtitle: Text(DateFormat("MMMM d, y") 112 | .add_jm() 113 | .format(e.time)), 114 | ), 115 | )) 116 | .toList(), 117 | )), 118 | selector: (p0, p1) => p1.getHistory()) 119 | ], 120 | ), 121 | ), 122 | ); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /lib/screens/tasks.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:koduko/components/create_task_bottom_sheet.dart'; 3 | import 'package:koduko/components/header.dart'; 4 | import 'package:koduko/components/task_tile.dart'; 5 | import 'package:koduko/models/task.dart'; 6 | import 'package:koduko/services/routines_provider.dart'; 7 | import 'package:koduko/services/tasks_provider.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class TasksScreen extends StatelessWidget { 11 | const TasksScreen({super.key, this.isBottomNavWidget = false}); 12 | static const routeName = "/tasks"; 13 | final bool isBottomNavWidget; 14 | @override 15 | Widget build(BuildContext context) { 16 | void addTask(Task t) { 17 | Provider.of(context, listen: false).add(t); 18 | } 19 | 20 | void onEdit(Task t) { 21 | Provider.of(context, listen: false).edit(t); 22 | Provider.of(context, listen: false).editTask(t); 23 | } 24 | 25 | void onCreateTask() async { 26 | Task? t = await showModalBottomSheet( 27 | isScrollControlled: true, 28 | isDismissible: true, 29 | shape: const RoundedRectangleBorder( 30 | borderRadius: BorderRadius.vertical( 31 | top: Radius.circular(10), 32 | bottom: Radius.zero, 33 | ), 34 | ), 35 | context: context, 36 | builder: ((context) => const CreateTaskBottomSheet())); 37 | if (t != null) { 38 | addTask(t); 39 | } 40 | } 41 | 42 | return Scaffold( 43 | floatingActionButton: FloatingActionButton( 44 | onPressed: onCreateTask, 45 | child: const Icon(Icons.add), 46 | ), 47 | body: Consumer( 48 | builder: ((context, value, child) => value.tasks.isEmpty 49 | ? SafeArea( 50 | child: Padding( 51 | padding: const EdgeInsets.symmetric( 52 | vertical: 20, horizontal: 10), 53 | child: Column( 54 | crossAxisAlignment: CrossAxisAlignment.start, 55 | children: [ 56 | child ?? Container(), 57 | const Spacer(), 58 | Text( 59 | "Looks like you haven't created any tasks", 60 | style: Theme.of(context) 61 | .textTheme 62 | .headlineMedium! 63 | .apply( 64 | color: Theme.of(context) 65 | .colorScheme 66 | .onSurface), 67 | textAlign: TextAlign.center, 68 | ), 69 | const SizedBox(height: 10), 70 | Center( 71 | child: TextButton.icon( 72 | icon: const Icon(Icons.add), 73 | onPressed: onCreateTask, 74 | label: const Text( 75 | "Create One", 76 | style: TextStyle(fontSize: 18), 77 | )), 78 | ), 79 | const Spacer(), 80 | ], 81 | ), 82 | ), 83 | ) 84 | : ListView.builder( 85 | itemCount: value.tasks.length, 86 | itemBuilder: (context, index) { 87 | if (index == 0) { 88 | return Padding( 89 | padding: 90 | const EdgeInsets.only(top: 20, right: 10, left: 10), 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | children: [ 94 | child ?? Container(), 95 | const SizedBox(height: 25), 96 | TaskTile( 97 | task: value.tasks[index], 98 | onEdit: onEdit, 99 | ) 100 | ], 101 | ), 102 | ); 103 | } 104 | return Padding( 105 | padding: const EdgeInsets.symmetric(horizontal: 10), 106 | child: TaskTile( 107 | task: value.tasks[index], 108 | onEdit: onEdit, 109 | )); 110 | })), 111 | child: isBottomNavWidget 112 | ? Padding( 113 | padding: const EdgeInsets.symmetric(horizontal: 8), 114 | child: Text( 115 | "My Task", 116 | style: Theme.of(context).textTheme.headlineLarge!.apply( 117 | color: Theme.of(context).colorScheme.onSurface), 118 | ), 119 | ) 120 | : const ScreenHeader( 121 | text: "My Tasks", 122 | tag: "My Tasks", 123 | )), 124 | ); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /lib/services/notification_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_local_notifications/flutter_local_notifications.dart'; 3 | import 'package:intl/intl.dart'; 4 | import 'package:rxdart/subjects.dart'; 5 | import 'package:timezone/timezone.dart' as tz; 6 | 7 | class NotificationService { 8 | static final NotificationService _notificationService = 9 | NotificationService._internal(); 10 | 11 | factory NotificationService() { 12 | return _notificationService; 13 | } 14 | 15 | NotificationService._internal(); 16 | 17 | final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = 18 | FlutterLocalNotificationsPlugin(); 19 | 20 | final BehaviorSubject onNotificationClick = BehaviorSubject(); 21 | 22 | Future showNotification({ 23 | required String title, 24 | required String body, 25 | required String uId, 26 | }) async { 27 | await _flutterLocalNotificationsPlugin.show( 28 | 0, 29 | title, 30 | body, 31 | NotificationDetails( 32 | android: AndroidNotificationDetails( 33 | '001', 34 | 'Notifications', 35 | channelDescription: 'Notifications', 36 | tag: uId, 37 | ), 38 | ), 39 | ); 40 | } 41 | 42 | Future scheduleDaily({ 43 | required TimeOfDay time, 44 | required String title, 45 | required String des, 46 | required String uId, 47 | }) async { 48 | await _flutterLocalNotificationsPlugin.zonedSchedule( 49 | ValueKey(uId).hashCode, 50 | title, 51 | des, 52 | _dailyAt(time), 53 | const NotificationDetails( 54 | android: AndroidNotificationDetails( 55 | '002', 56 | 'Daily Routine Notifications', 57 | channelDescription: 'Daily Routine Notifications', 58 | ), 59 | ), 60 | payload: uId, 61 | androidAllowWhileIdle: true, 62 | uiLocalNotificationDateInterpretation: 63 | UILocalNotificationDateInterpretation.absoluteTime, 64 | matchDateTimeComponents: DateTimeComponents.time, 65 | ); 66 | } 67 | 68 | Future scheduleWeekly({ 69 | required TimeOfDay time, 70 | required String title, 71 | required String des, 72 | required String day, 73 | required String uId, 74 | }) async { 75 | await _flutterLocalNotificationsPlugin.zonedSchedule( 76 | ValueKey(uId + day).hashCode, 77 | title, 78 | des, 79 | _scheduleWeekly(time, day), 80 | const NotificationDetails( 81 | android: AndroidNotificationDetails( 82 | '003', 83 | 'Weekly Routine Notifications', 84 | channelDescription: 'Weekly Routine Notifications', 85 | ), 86 | ), 87 | payload: uId, 88 | androidAllowWhileIdle: true, 89 | uiLocalNotificationDateInterpretation: 90 | UILocalNotificationDateInterpretation.absoluteTime, 91 | matchDateTimeComponents: DateTimeComponents.dayOfWeekAndTime, 92 | ); 93 | } 94 | 95 | // Future showProgressNotification( 96 | // double value, 97 | // String name, 98 | // String sub, 99 | // ) async { 100 | // final progress = (value * 100).toInt(); 101 | // final AndroidNotificationDetails androidPlatformChannelSpecifics = 102 | // AndroidNotificationDetails( 103 | // 'task progress channel', 104 | // 'task progress channel', 105 | // channelDescription: 'displays current task progress', 106 | // channelShowBadge: false, 107 | // priority: Priority.high, 108 | // onlyAlertOnce: true, 109 | // showProgress: true, 110 | // maxProgress: 100, 111 | // progress: progress, 112 | // ); 113 | // final NotificationDetails platformChannelSpecifics = 114 | // NotificationDetails(android: androidPlatformChannelSpecifics); 115 | // await _flutterLocalNotificationsPlugin.show( 116 | // 777, 117 | // name, 118 | // sub, 119 | // platformChannelSpecifics, 120 | // ); 121 | // } 122 | 123 | Future scheduledNotification( 124 | Duration dur, String id, String title, String des) async { 125 | await _flutterLocalNotificationsPlugin.zonedSchedule( 126 | ValueKey(id).hashCode, 127 | title, 128 | des, 129 | tz.TZDateTime.now(tz.local).add(dur), 130 | const NotificationDetails( 131 | android: AndroidNotificationDetails( 132 | 'TaskCompleted', 'Task Completed', 133 | channelDescription: 'Task Completed Notification')), 134 | androidAllowWhileIdle: true, 135 | uiLocalNotificationDateInterpretation: 136 | UILocalNotificationDateInterpretation.absoluteTime); 137 | } 138 | 139 | Future getDeviceLaunchInfo() async { 140 | return await _flutterLocalNotificationsPlugin 141 | .getNotificationAppLaunchDetails(); 142 | } 143 | 144 | Future cancelNotification(String id) async { 145 | await _flutterLocalNotificationsPlugin.cancel(ValueKey(id).hashCode); 146 | } 147 | 148 | Future cancelNotificationWithId(int id) async { 149 | await _flutterLocalNotificationsPlugin.cancel(id); 150 | } 151 | 152 | Future cancelAllNotifications() async { 153 | await _flutterLocalNotificationsPlugin.cancelAll(); 154 | } 155 | 156 | tz.TZDateTime _dailyAt(TimeOfDay time) { 157 | final tz.TZDateTime now = tz.TZDateTime.now(tz.local); 158 | tz.TZDateTime scheduledDate = tz.TZDateTime( 159 | tz.local, now.year, now.month, now.day, time.hour, time.minute); 160 | if (scheduledDate.isBefore(now)) { 161 | scheduledDate = scheduledDate.add(const Duration(days: 1)); 162 | } 163 | return scheduledDate; 164 | } 165 | 166 | tz.TZDateTime _scheduleWeekly( 167 | TimeOfDay time, 168 | String day, 169 | ) { 170 | tz.TZDateTime scheduledDate = _dailyAt(time); 171 | var cDay = DateFormat('EEEE').format(scheduledDate); 172 | while (cDay != day) { 173 | scheduledDate = scheduledDate.add(const Duration(days: 1)); 174 | cDay = DateFormat('EEEE').format(scheduledDate); 175 | } 176 | 177 | return scheduledDate; 178 | } 179 | 180 | Future initialize() async { 181 | const AndroidInitializationSettings androidInitializationSettings = 182 | AndroidInitializationSettings('app_icon'); 183 | 184 | const InitializationSettings settings = InitializationSettings( 185 | android: androidInitializationSettings, 186 | ); 187 | 188 | void onSelectNotification(NotificationResponse? response) { 189 | if (response != null) { 190 | if (response.payload?.isNotEmpty ?? false) { 191 | onNotificationClick.add(response.payload); 192 | } 193 | } 194 | } 195 | 196 | await _flutterLocalNotificationsPlugin.initialize( 197 | settings, 198 | onDidReceiveNotificationResponse: onSelectNotification, 199 | ); 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /lib/services/tasks_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:collection'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:hive_flutter/adapters.dart'; 5 | import 'package:koduko/models/task.dart'; 6 | 7 | class TaskModel extends ChangeNotifier { 8 | late final List _tasks; 9 | final _box = Hive.box('Tasks'); 10 | 11 | UnmodifiableListView get tasks => UnmodifiableListView(_tasks); 12 | 13 | TaskModel() { 14 | _init(); 15 | } 16 | 17 | void _init() async { 18 | if (_box.isOpen) { 19 | _tasks = _box.values.toList(); 20 | } else { 21 | await Hive.openBox('Tasks'); 22 | } 23 | } 24 | 25 | void add(Task task) { 26 | _tasks.add(task); 27 | _box.add(task); 28 | notifyListeners(); 29 | } 30 | 31 | void edit(Task task) { 32 | int index = 33 | _tasks.indexWhere((element) => element.id.compareTo(task.id) == 0); 34 | if (index > -1) { 35 | _box.putAt(index, task); 36 | _tasks[index] = task; 37 | notifyListeners(); 38 | } 39 | } 40 | 41 | void delete(String id) { 42 | if (_tasks.indexWhere((element) => element.id.compareTo(id) == 0) > -1) { 43 | _box.deleteAt( 44 | _tasks.indexWhere((element) => element.id.compareTo(id) == 0)); 45 | _tasks.removeWhere((element) => element.id.compareTo(id) == 0); 46 | notifyListeners(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/services/theme_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hive/hive.dart'; 3 | 4 | class ThemeModel with ChangeNotifier { 5 | var _themeMode = ThemeMode.system; 6 | final _box = Hive.box('Theme'); 7 | 8 | get getTheme => _themeMode; 9 | setTheme(themeMode) { 10 | _themeMode = themeMode; 11 | _box.put("darkMode", themeMode == ThemeMode.dark); 12 | notifyListeners(); 13 | } 14 | 15 | bool isDark() => _themeMode == ThemeMode.dark; 16 | 17 | ThemeModel() { 18 | if (_box.isOpen) { 19 | if (_box.get("darkMode") != null) { 20 | _themeMode = _box.get("darkMode")! ? ThemeMode.dark : ThemeMode.light; 21 | } else { 22 | _themeMode = ThemeMode.system; 23 | } 24 | } 25 | } 26 | 27 | toggleTheme() { 28 | switch (_themeMode) { 29 | case ThemeMode.dark: 30 | _themeMode = ThemeMode.light; 31 | _box.put("darkMode", false); 32 | break; 33 | case ThemeMode.light: 34 | _themeMode = ThemeMode.system; 35 | _box.delete('darkMode'); 36 | break; 37 | case ThemeMode.system: 38 | _themeMode = ThemeMode.dark; 39 | _box.put("darkMode", true); 40 | break; 41 | default: 42 | _themeMode = _themeMode; 43 | } 44 | notifyListeners(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/utils/colors_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | Color darken(Color color, [double amount = .1]) { 4 | assert(amount >= 0 && amount <= 1); 5 | 6 | final hsl = HSLColor.fromColor(color); 7 | final hslDark = hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0)); 8 | 9 | return hslDark.toColor(); 10 | } 11 | 12 | Color lighten(Color color, [double amount = .1]) { 13 | assert(amount >= 0 && amount <= 1); 14 | 15 | final hsl = HSLColor.fromColor(color); 16 | final hslLight = hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0)); 17 | 18 | return hslLight.toColor(); 19 | } 20 | -------------------------------------------------------------------------------- /lib/utils/date_time_extension.dart: -------------------------------------------------------------------------------- 1 | extension DateOnlyCompare on DateTime { 2 | bool isSameDate(DateTime other) { 3 | return year == other.year && month == other.month && day == other.day; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /lib/utils/duration_to_string.dart: -------------------------------------------------------------------------------- 1 | String durationToString(Duration duration) { 2 | return '${duration.inMinutes}:${(duration.inSeconds % 60).toString().padLeft(2, '0')}'; 3 | } 4 | -------------------------------------------------------------------------------- /lib/utils/greetings.dart: -------------------------------------------------------------------------------- 1 | String greeting() { 2 | var hour = DateTime.now().hour; 3 | if (hour < 12) { 4 | return 'Morning'; 5 | } 6 | if (hour < 17) { 7 | return 'Afternoon'; 8 | } 9 | return 'Evening'; 10 | } 11 | -------------------------------------------------------------------------------- /lib/utils/parse_duration.dart: -------------------------------------------------------------------------------- 1 | Duration parseDuration(String s) { 2 | int hours = 0; 3 | int minutes = 0; 4 | int micros; 5 | List parts = s.split(':'); 6 | if (parts.length > 2) { 7 | hours = int.parse(parts[parts.length - 3]); 8 | } 9 | if (parts.length > 1) { 10 | minutes = int.parse(parts[parts.length - 2]); 11 | } 12 | micros = (double.parse(parts[parts.length - 1]) * 1000000).round(); 13 | return Duration(hours: hours, minutes: minutes, microseconds: micros); 14 | } 15 | -------------------------------------------------------------------------------- /lib/utils/time_of_day_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | DateTime? timeOfDayToDateTime(TimeOfDay? t) { 4 | if (t == null) { 5 | return null; 6 | } 7 | final now = DateTime.now(); 8 | return DateTime(now.year, now.month, now.day, t.hour, t.minute); 9 | } 10 | 11 | TimeOfDay dateTimeToTimeOfDay(DateTime t) { 12 | return TimeOfDay.fromDateTime(t); 13 | } 14 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "koduko") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.koduko") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) dynamic_color_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin"); 15 | dynamic_color_plugin_register_with_registrar(dynamic_color_registrar); 16 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 18 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | dynamic_color 7 | url_launcher_linux 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "koduko"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "koduko"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import dynamic_color 9 | import flutter_local_notifications 10 | import flutter_native_timezone 11 | import path_provider_foundation 12 | import url_launcher_macos 13 | 14 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 15 | DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) 16 | FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) 17 | FlutterNativeTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterNativeTimezonePlugin")) 18 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 19 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 20 | } 21 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = koduko 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.koduko 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: koduko 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.2+4 19 | 20 | environment: 21 | sdk: ">=2.17.1 <3.22.1" 22 | 23 | # Dependencies specify other packages that your package needs in order to work. 24 | # To automatically upgrade your package dependencies to the latest versions 25 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 26 | # dependencies can be manually updated by changing the version numbers below to 27 | # the latest version available on pub.dev. To see which dependencies have newer 28 | # versions available, run `flutter pub outdated`. 29 | dependencies: 30 | flutter: 31 | sdk: flutter 32 | 33 | # The following adds the Cupertino Icons font to your application. 34 | # Use with the CupertinoIcons class for iOS style icons. 35 | cupertino_icons: ^1.0.2 36 | hive_flutter: ^1.1.0 37 | hive: ^2.2.3 38 | provider: ^6.0.3 39 | uuid: ^4.4.0 40 | google_fonts: ^6.2.1 41 | intl: ^0.19.0 42 | fl_chart: ^0.68.0 43 | flutter_slidable: ^3.1.0 44 | percent_indicator: ^4.2.2 45 | collection: ^1.16.0 46 | flutter_local_notifications: ^17.1.2 47 | rxdart: ^0.28.0 48 | timezone: ^0.9.0 49 | flutter_native_timezone: ^2.0.0 50 | url_launcher: ^6.1.5 51 | dynamic_color: ^1.6.9 52 | duration_picker: ^1.2.0 53 | logger: ^2.3.0 54 | 55 | # flutter_icons: 56 | # android: "launcher_icon" 57 | # ios: true 58 | # image_path: "assets/icon/icon.png" 59 | 60 | dev_dependencies: 61 | flutter_test: 62 | sdk: flutter 63 | 64 | flutter_lints: ^4.0.0 65 | hive_generator: ^2.0.1 66 | build_runner: ^2.1.11 67 | flutter_launcher_icons: ^0.13.1 68 | 69 | # For information on the generic Dart part of this file, see the 70 | # following page: https://dart.dev/tools/pub/pubspec 71 | 72 | # The following section is specific to Flutter packages. 73 | flutter: 74 | # The following line ensures that the Material Icons font is 75 | # included with your application, so that you can use the icons in 76 | # the material Icons class. 77 | uses-material-design: true 78 | 79 | # To add assets to your application, add an assets section, like this: 80 | assets: 81 | - assets/icon/icon.png 82 | - assets/onboarding/ 83 | 84 | # An image asset can refer to one or more resolution-specific "variants", see 85 | # https://flutter.dev/assets-and-images/#resolution-aware 86 | 87 | # For details regarding adding assets from package dependencies, see 88 | # https://flutter.dev/assets-and-images/#from-packages 89 | 90 | # To add custom fonts to your application, add a fonts section here, 91 | # in this "flutter" section. Each entry in this list should have a 92 | # "family" key with the font family name, and a "fonts" key with a 93 | # list giving the asset and other descriptors for the font. For 94 | # example: 95 | # fonts: 96 | # - family: Schyler 97 | # fonts: 98 | # - asset: fonts/Schyler-Regular.ttf 99 | # - asset: fonts/Schyler-Italic.ttf 100 | # style: italic 101 | # - family: Trajan Pro 102 | # fonts: 103 | # - asset: fonts/TrajanPro.ttf 104 | # - asset: fonts/TrajanPro_Bold.ttf 105 | # weight: 700 106 | # 107 | # For details regarding fonts from package dependencies, 108 | # see https://flutter.dev/custom-fonts/#from-packages 109 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:koduko/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | koduko 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "koduko", 3 | "short_name": "koduko", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(koduko LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "koduko") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | DynamicColorPluginCApiRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); 15 | UrlLauncherWindowsRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 17 | } 18 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | dynamic_color 7 | url_launcher_windows 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Disable Windows macros that collide with C++ standard library functions. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 25 | 26 | # Add dependency libraries and include directories. Add any application-specific 27 | # dependencies here. 28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 30 | 31 | # Run the Flutter tool portions of the build. This must not be removed. 32 | add_dependencies(${BINARY_NAME} flutter_assemble) 33 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "koduko" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "koduko" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "koduko.exe" "\0" 98 | VALUE "ProductName", "koduko" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"koduko", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mazahir26/koduko/867245938a0a4af5943ee18da95ad58a4d98edb7/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------