├── .gitignore ├── .metadata ├── README.md ├── ROADMAP.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── nacro90 │ │ │ │ └── groen │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── flutter_jank_metrics_01.json ├── flutter_jank_metrics_02.json ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── 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 │ │ ├── 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 ├── data │ ├── chardef.dart │ ├── deserializer │ │ ├── deserializer.dart │ │ ├── petit │ │ │ ├── deserializer.dart │ │ │ ├── grammar.dart │ │ │ ├── helper.dart │ │ │ ├── model.dart │ │ │ ├── parser.dart │ │ │ └── petit.dart │ │ └── quill │ │ │ ├── deserializer.dart │ │ │ └── quill.dart │ ├── model │ │ ├── attachedmod.dart │ │ ├── document.dart │ │ ├── escaping.dart │ │ ├── exception.dart │ │ ├── linkable.dart │ │ ├── model.dart │ │ ├── node.dart │ │ ├── paragraph.dart │ │ └── text.dart │ ├── serializer │ │ ├── quill │ │ │ ├── node.dart │ │ │ ├── quill.dart │ │ │ └── serializer.dart │ │ ├── serializer.dart │ │ └── text │ │ │ ├── serializer.dart │ │ │ └── text.dart │ └── string.dart ├── main.dart └── ui │ ├── editor │ ├── screen.dart │ └── viewmodel.dart │ ├── editor_page.dart │ ├── editor_view_model.dart │ ├── list_page.dart │ ├── settings_page.dart │ └── two_state_future_builder.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 ├── Podfile ├── 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 └── core │ ├── deserializer │ └── petit │ │ ├── deserializer_test.dart │ │ ├── deserializer_test.mocks.dart │ │ ├── grammar_test.dart │ │ └── parser_test.dart │ └── serializer │ └── quill │ └── node_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 /.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 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /.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: 6928314d505d2bb4777be05e45d7808a5aa91d2a 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: 6928314d505d2bb4777be05e45d7808a5aa91d2a 17 | base_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 18 | - platform: android 19 | create_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 20 | base_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 21 | - platform: ios 22 | create_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 23 | base_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 24 | - platform: linux 25 | create_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 26 | base_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 27 | - platform: macos 28 | create_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 29 | base_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 30 | - platform: web 31 | create_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 32 | base_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 33 | - platform: windows 34 | create_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 35 | base_revision: 6928314d505d2bb4777be05e45d7808a5aa91d2a 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Groen 2 | 3 | _At the moment this app has no usable functionality. There are lots of bugs, blood and tear._ 4 | 5 | Neorg mobile app that inspired by Obsidian. 6 | 7 | ## FAQ 8 | 9 | ### Name? 10 | It is Neorg in reverse. Also it means _green_ in Dutch. 11 | 12 | ### How to shape the [roadmap](./ROADMAP.md) 13 | - Join the [Discord channel](https://discord.gg/affpThD5) 14 | - Open an issue 15 | -------------------------------------------------------------------------------- /ROADMAP.md: -------------------------------------------------------------------------------- 1 | # Groen Roadmap 2 | 3 | In its early stages in its lifetime, Groen has a potential to be a powerful note taking, 4 | organization and todo app thanks to _Norg_ file format. To achive its potential it is better to 5 | share thoughts and roadmap for future contributions. 6 | 7 | See also: [Neorg Mobile Application Roadmap](https://github.com/nvim-neorg/neorg/blob/main/ROADMAP.md#mobile-application) 8 | 9 | ## Considerations 10 | 11 | ### Mobile first and feel as native as possible 12 | Self-exlplanatory. As a key feature of Flutter, iOS and Android are both supported. And they should 13 | feel as native as possible. It can be achived in the Flutter code base. The user experience of 14 | mobile platforms prioritized over desktop platforms. Desktop platforms will be supported but it will 15 | be secondary. Web support is not planned for now. May be just a web Norg editor for demo purposes. 16 | 17 | ### Norg format as first class 18 | As expected, the source of truth is the Norg files on the local filesystem. All the workspace 19 | context should be created according to them. So, there should be listeners to filesystem that 20 | invalidates caches and indexes in case of any external change to any workspace file. Additionally 21 | conflicting changes must be handled without any data loss. 22 | 23 | ### Ease of using as a default text editor 24 | Having to switch to different editor while capturing your thoughts leads to bad user experience. The 25 | app can display and edit any text file. 26 | 27 | ### Image support 28 | Images may carry more information than text. Norg format has file link feature that allows us to 29 | link any file in the workspace. There is no separate link type for images yet. But they can be 30 | linked with generic file link for now. 31 | 32 | ### Not just for power users 33 | You most likely to have some Neovim experience. You are capable to edit your Norg files easily with 34 | your editor and you are waiting for this app to resolve your needs. But mobile apps are open to 35 | anyone, not just terminal nerds like us. So, any user can install the app and taking notes even 36 | without have to know the Norg file format using the UI/UX features. Which means the app will support 37 | both WYSIWYG and WYSINWYG style editing. They will gradually become power users when they want 38 | comfortably. Trust the magic of Norg. 39 | 40 | ### Not altering the files unnecesarily 41 | Displaying a plain text file format in a mobile application brings a challenge of the altering the 42 | files in realtime without changing _too much_. The app have to be capable of editing as either 43 | WYSIWYG and WYSINWYG. When the _what you see is not what you get_ editing active, the changes in the 44 | UI content have to be interpreted to the Norg format. This interpretation should not format whole 45 | file. Because of in the Norg format whitespaces are not that important, every Neorg user can have 46 | different styling choices. The changes in UI have to change the Norg file in a scope that as small 47 | as possible. 48 | 49 | ### Indexing using SQLite 50 | Note collections can contain massive number of files. It may be impossible to search, link 51 | autocomplete and refactor fast. There have to be indexes. Neovim can make use of SQLite database 52 | using [SQLite plugin](https://github.com/kkharji/SQLite.lua). So, the database choice is SQLite to 53 | allow future integrations with Neovim and Neorg. SQLite has full text search capabilities with 54 | [FTS5](https://www.sqlite.org/fts5.html) extension. Indexing provides us fast linking, backlinking, 55 | tagging, searching and refactoring capabilities. 56 | 57 | ### Extensive search based usage 58 | Recalling the thoughts is crucial. With a workspace that have hundreds of notes, file-explorer or 59 | tree like UI elements get less effective while navigating between notes. Searching fast and easy is 60 | the key of navigation at some point. With the help of the indexes and caches, notes can be searched 61 | by their content, tags, ids (zettel), workspace and filename. The list of searchable elements may 62 | grow in future. Search input accepts a simple query to get what to search but it is not necessary. 63 | If the input has not special query key, results will still include tags etc. They will just be 64 | displayed in default order/priority. 65 | 66 | ### Plugin system using Dart FFI 67 | Dart can run external executables with FFI. This feature can be used for a plugin system that 68 | accepts any programming language that supports FFI (Rust, Go, C, Python). Some features like 69 | calendar and TODO may provided as a New parsers for different file formats may provided as 70 | offically supported plugins that can be disabled. In that way attraction to the features can be 71 | tracked without compromising any individual privacy. The FFI system may not appropriate for security 72 | concerns. This topic needs a proper discussion, research and POC. 73 | 74 | ## Versions 75 | 76 | [_semver_](https://semver.org/) versioning will be used. 77 | 78 | ### Version 0.1.0 - MVP Release 79 | Initial release aims to display and edit Norg files in a local workspace, simple usages of links, 80 | some UI functionality for non-code usage. 81 | 82 | 1. [x] Implement a level 1 parser in pure Dart 83 | 2. [x] Display the parsed content in a mock editor 84 | 3. [x] Implement a simple edit-parse-display loop 85 | 4. [ ] Implement a level 2 parser 86 | 5. [ ] Externalize the Norg parser as a flutter/dart library 87 | 9. [ ] Implement toggle-able autosave 88 | 6. [ ] Choose an appropriate editor library 89 | 7. [ ] Implement directing `{:link:}` link format without db or cache 90 | 8. [ ] Implement a level 3 parser 91 | 9. [ ] Implement a proper design 92 | 93 | -------------------------------------------------------------------------------- /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 | 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 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 33 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.nacro90.groen" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion 21 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 16 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/nacro90/groen/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.nacro90.groen 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /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/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.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 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1300; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = ( 294 | "$(inherited)", 295 | "@executable_path/Frameworks", 296 | ); 297 | PRODUCT_BUNDLE_IDENTIFIER = com.nacro90.groen; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 300 | SWIFT_VERSION = 5.0; 301 | VERSIONING_SYSTEM = "apple-generic"; 302 | }; 303 | name = Profile; 304 | }; 305 | 97C147031CF9000F007C117D /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ALWAYS_SEARCH_USER_PATHS = NO; 309 | CLANG_ANALYZER_NONNULL = YES; 310 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 311 | CLANG_CXX_LIBRARY = "libc++"; 312 | CLANG_ENABLE_MODULES = YES; 313 | CLANG_ENABLE_OBJC_ARC = YES; 314 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_COMMA = YES; 317 | CLANG_WARN_CONSTANT_CONVERSION = YES; 318 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 320 | CLANG_WARN_EMPTY_BODY = YES; 321 | CLANG_WARN_ENUM_CONVERSION = YES; 322 | CLANG_WARN_INFINITE_RECURSION = YES; 323 | CLANG_WARN_INT_CONVERSION = YES; 324 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 325 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 326 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 329 | CLANG_WARN_STRICT_PROTOTYPES = YES; 330 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | DEBUG_INFORMATION_FORMAT = dwarf; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | ENABLE_TESTABILITY = YES; 338 | GCC_C_LANGUAGE_STANDARD = gnu99; 339 | GCC_DYNAMIC_NO_PIC = NO; 340 | GCC_NO_COMMON_BLOCKS = YES; 341 | GCC_OPTIMIZATION_LEVEL = 0; 342 | GCC_PREPROCESSOR_DEFINITIONS = ( 343 | "DEBUG=1", 344 | "$(inherited)", 345 | ); 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 353 | MTL_ENABLE_DEBUG_INFO = YES; 354 | ONLY_ACTIVE_ARCH = YES; 355 | SDKROOT = iphoneos; 356 | TARGETED_DEVICE_FAMILY = "1,2"; 357 | }; 358 | name = Debug; 359 | }; 360 | 97C147041CF9000F007C117D /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_ANALYZER_NONNULL = YES; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_COMMA = YES; 372 | CLANG_WARN_CONSTANT_CONVERSION = YES; 373 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 374 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 375 | CLANG_WARN_EMPTY_BODY = YES; 376 | CLANG_WARN_ENUM_CONVERSION = YES; 377 | CLANG_WARN_INFINITE_RECURSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 380 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 381 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 383 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 384 | CLANG_WARN_STRICT_PROTOTYPES = YES; 385 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 389 | COPY_PHASE_STRIP = NO; 390 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 391 | ENABLE_NS_ASSERTIONS = NO; 392 | ENABLE_STRICT_OBJC_MSGSEND = YES; 393 | GCC_C_LANGUAGE_STANDARD = gnu99; 394 | GCC_NO_COMMON_BLOCKS = YES; 395 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 396 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 397 | GCC_WARN_UNDECLARED_SELECTOR = YES; 398 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 399 | GCC_WARN_UNUSED_FUNCTION = YES; 400 | GCC_WARN_UNUSED_VARIABLE = YES; 401 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 402 | MTL_ENABLE_DEBUG_INFO = NO; 403 | SDKROOT = iphoneos; 404 | SUPPORTED_PLATFORMS = iphoneos; 405 | SWIFT_COMPILATION_MODE = wholemodule; 406 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 407 | TARGETED_DEVICE_FAMILY = "1,2"; 408 | VALIDATE_PRODUCT = YES; 409 | }; 410 | name = Release; 411 | }; 412 | 97C147061CF9000F007C117D /* Debug */ = { 413 | isa = XCBuildConfiguration; 414 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | CLANG_ENABLE_MODULES = YES; 418 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 419 | ENABLE_BITCODE = NO; 420 | INFOPLIST_FILE = Runner/Info.plist; 421 | LD_RUNPATH_SEARCH_PATHS = ( 422 | "$(inherited)", 423 | "@executable_path/Frameworks", 424 | ); 425 | PRODUCT_BUNDLE_IDENTIFIER = com.nacro90.groen; 426 | PRODUCT_NAME = "$(TARGET_NAME)"; 427 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | SWIFT_VERSION = 5.0; 430 | VERSIONING_SYSTEM = "apple-generic"; 431 | }; 432 | name = Debug; 433 | }; 434 | 97C147071CF9000F007C117D /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CLANG_ENABLE_MODULES = YES; 440 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 441 | ENABLE_BITCODE = NO; 442 | INFOPLIST_FILE = Runner/Info.plist; 443 | LD_RUNPATH_SEARCH_PATHS = ( 444 | "$(inherited)", 445 | "@executable_path/Frameworks", 446 | ); 447 | PRODUCT_BUNDLE_IDENTIFIER = com.nacro90.groen; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 450 | SWIFT_VERSION = 5.0; 451 | VERSIONING_SYSTEM = "apple-generic"; 452 | }; 453 | name = Release; 454 | }; 455 | /* End XCBuildConfiguration section */ 456 | 457 | /* Begin XCConfigurationList section */ 458 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147031CF9000F007C117D /* Debug */, 462 | 97C147041CF9000F007C117D /* Release */, 463 | 249021D3217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 469 | isa = XCConfigurationList; 470 | buildConfigurations = ( 471 | 97C147061CF9000F007C117D /* Debug */, 472 | 97C147071CF9000F007C117D /* Release */, 473 | 249021D4217E4FDB00AE95B9 /* Profile */, 474 | ); 475 | defaultConfigurationIsVisible = 0; 476 | defaultConfigurationName = Release; 477 | }; 478 | /* End XCConfigurationList section */ 479 | }; 480 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 481 | } 482 | -------------------------------------------------------------------------------- /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 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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 | Groen 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | groen 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 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/data/deserializer/deserializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:groen/data/model/model.dart'; 2 | 3 | export 'petit/petit.dart'; 4 | 5 | abstract class Deserializer { 6 | Node deserialize(T input); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /lib/data/deserializer/petit/deserializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:groen/data/deserializer/deserializer.dart'; 2 | import 'package:groen/data/model/exception.dart'; 3 | import 'package:groen/data/model/model.dart'; 4 | import 'package:petitparser/petitparser.dart'; 5 | 6 | class PetitDeserializer implements Deserializer { 7 | final Parser _parser; 8 | 9 | const PetitDeserializer(this._parser); 10 | 11 | @override 12 | Node deserialize(String input) { 13 | final result = _parser.parse(input); 14 | if (result.isFailure) { 15 | throw DeserializeException(result.message); 16 | } 17 | return result.value; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/data/deserializer/petit/grammar.dart: -------------------------------------------------------------------------------- 1 | import 'package:groen/data/chardef.dart'; 2 | import 'package:petitparser/petitparser.dart'; 3 | 4 | import 'helper.dart'; 5 | 6 | class NorgGrammar extends GrammarDefinition { 7 | const NorgGrammar(); 8 | 9 | @override 10 | Parser start() => ref0(document).end(); 11 | 12 | Parser document() => [ 13 | ref0(_anyWhitepace).star(), 14 | ref0(paragraph).starSeparatedList(ref0(paragraphBreak)), 15 | ref0(_anyWhitepace).star(), 16 | ] 17 | .toSequenceParser() 18 | .map((matches) => matches.expand((match) => match).toList()); 19 | 20 | Parser paragraph() => 21 | ref0(paragraphSegment).starSeparatedList(ref0(lineEnding)); 22 | 23 | Parser paragraphSegment() => [ 24 | ref0(link), 25 | ref0(escaping), 26 | ref0(attachedModifiedElement), 27 | ref0(norgWhitespace), 28 | ref0(plainText), 29 | ].toChoiceParser().plus(); 30 | 31 | Parser plainText() => whitespace().neg().plus().flatten('plaintext'); 32 | 33 | Parser link() => [ 34 | ref0(url), 35 | ].toChoiceParser(); 36 | 37 | Parser url() => (char('{') & 38 | seq2( 39 | newline().not(), 40 | [ 41 | ref0(paragraphBreak), 42 | seq2(newline(), char('}')), 43 | char('}'), 44 | ].toChoiceParser().neg().plus(), 45 | ).flatten('location') & 46 | char('}')); 47 | 48 | Parser attachedModifierContent(String c) => [ 49 | whitespace().not(), 50 | [ 51 | ref0(paragraphBreak), 52 | (whitespace() & char(c)), 53 | char(c), 54 | ].toChoiceParser().neg().plus(), 55 | ].toSequenceParser().flatten('content'); 56 | 57 | Parser attachedModified(String c) => 58 | char(c) & ref1(attachedModifierContent, c) & char(c); 59 | Parser bold() => ref1(attachedModified, '*'); 60 | Parser italic() => ref1(attachedModified, '/'); 61 | Parser underline() => ref1(attachedModified, '_'); 62 | Parser strikethrough() => ref1(attachedModified, '-'); 63 | Parser spoiler() => ref1(attachedModified, '!'); 64 | Parser superscript() => ref1(attachedModified, '^'); 65 | Parser subscript() => ref1(attachedModified, ','); 66 | Parser inlineCode() => ref1(attachedModified, '`'); 67 | Parser inlineComment() => ref1(attachedModified, '%'); 68 | Parser attachedModifiedElement() => [ 69 | ref0(bold), 70 | ref0(italic), 71 | ref0(underline), 72 | ref0(strikethrough), 73 | ref0(spoiler), 74 | ref0(superscript), 75 | ref0(subscript), 76 | ref0(inlineCode), 77 | ref0(inlineComment), 78 | ].toChoiceParser(); 79 | 80 | Parser escaping() => char('\\') & any(); 81 | 82 | Parser lineEnding() => newline(); 83 | 84 | Parser paragraphBreak() => 85 | newline().repeatSeparated(ref0(norgWhitespace).star(), 2, unbounded); 86 | 87 | Parser norgWhitespace() => whitespaces 88 | .map(charCode) 89 | .toChoiceParser(failureJoiner: selectLast) 90 | .plus() 91 | .flatten('whitespace'); 92 | 93 | Parser _anyWhitepace() => ref0(norgWhitespace) | ref0(lineEnding); 94 | } 95 | -------------------------------------------------------------------------------- /lib/data/deserializer/petit/helper.dart: -------------------------------------------------------------------------------- 1 | import 'package:petitparser/petitparser.dart'; 2 | 3 | Parser charCode(int code, [String? message]) { 4 | return CharacterParser( 5 | SingleCharPredicate(code), 6 | '"${message ?? String.fromCharCode(code)}" expected', 7 | ); 8 | } 9 | 10 | extension SurroundedParserExtension on Parser { 11 | Parser surroundedBy(Parser s) => s & this & s; 12 | } 13 | 14 | extension StarSeparatedList on Parser { 15 | Parser starSeparatedList(Parser p, {growable = false}) => 16 | starSeparated(p).map((s) => s.sequential.toList(growable: growable)); 17 | } 18 | -------------------------------------------------------------------------------- /lib/data/deserializer/petit/model.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:petitparser/petitparser.dart'; 3 | 4 | enum ParseTokenType { 5 | document, 6 | paragraph, 7 | paragraphSegment, 8 | url, 9 | attachedModifier, 10 | escaping, 11 | } 12 | 13 | class ParseToken extends Equatable { 14 | final ParseTokenType type; 15 | final int start; 16 | final int line; 17 | final int column; 18 | final List items; 19 | final String raw; 20 | 21 | const ParseToken({ 22 | required this.type, 23 | required this.start, 24 | required this.line, 25 | required this.column, 26 | required this.items, 27 | required this.raw, 28 | }); 29 | 30 | ParseToken.token(ParseTokenType type, Token token) 31 | : this( 32 | type: type, 33 | start: token.start, 34 | line: token.line, 35 | column: token.column, 36 | items: token.value, 37 | raw: token.input, 38 | ); 39 | 40 | int get length => raw.length; 41 | 42 | int get stop => start + length; 43 | 44 | @override 45 | List get props => [type, start, line, column, items, raw]; 46 | } 47 | -------------------------------------------------------------------------------- /lib/data/deserializer/petit/parser.dart: -------------------------------------------------------------------------------- 1 | import 'package:groen/data/model/model.dart'; 2 | import 'package:petitparser/petitparser.dart'; 3 | 4 | import 'grammar.dart'; 5 | 6 | extension TokenNodeListCast on Token { 7 | List get nodes => (value as List).cast(); 8 | } 9 | 10 | class NorgParser extends NorgGrammar { 11 | const NorgParser(); 12 | 13 | @override 14 | Parser document() => super.document().token().map( 15 | (token) { 16 | return Document( 17 | start: token.start, 18 | line: token.line, 19 | column: token.column, 20 | raw: token.input, 21 | children: token.nodes, 22 | ); 23 | }, 24 | ); 25 | 26 | @override 27 | Parser paragraph() => super.paragraph().token().map( 28 | (token) => Paragraph( 29 | start: token.start, 30 | line: token.line, 31 | column: token.column, 32 | raw: token.input, 33 | children: token.nodes, 34 | ), 35 | ); 36 | 37 | @override 38 | Parser paragraphSegment() => super.paragraphSegment().token().map( 39 | (token) { 40 | return ParagraphSegment( 41 | start: token.start, 42 | line: token.line, 43 | column: token.column, 44 | raw: token.input, 45 | children: token.nodes, 46 | ); 47 | }, 48 | ); 49 | 50 | @override 51 | Parser attachedModified(String c) => super.attachedModified(c).token().map( 52 | (token) => AttachedModified( 53 | type: attachedModTypeByChar[token.value[0]]!, 54 | text: token.value[1], 55 | start: token.start, 56 | line: token.line, 57 | column: token.column, 58 | raw: token.input, 59 | ), 60 | ); 61 | 62 | @override 63 | Parser url() => super.url().token().map( 64 | (token) => Url( 65 | location: token.value[1], 66 | start: token.start, 67 | line: token.line, 68 | column: token.column, 69 | raw: token.input, 70 | ), 71 | ); 72 | 73 | @override 74 | Parser escaping() => super.escaping().token().map( 75 | (token) => Escaping( 76 | escaped: token.value[1], 77 | start: token.start, 78 | line: token.line, 79 | column: token.column, 80 | raw: token.input, 81 | ), 82 | ); 83 | 84 | @override 85 | Parser norgWhitespace() => super.norgWhitespace().token().map( 86 | (token) => Whitespace( 87 | start: token.start, 88 | line: token.line, 89 | column: token.column, 90 | raw: token.input, 91 | ), 92 | ); 93 | 94 | @override 95 | Parser plainText() { 96 | return super.plainText().token().map( 97 | (token) => PlainText( 98 | start: token.start, 99 | line: token.line, 100 | column: token.column, 101 | raw: token.input), 102 | ); 103 | } 104 | 105 | @override 106 | Parser lineEnding() => super.lineEnding().token().map( 107 | (token) => LineEnding( 108 | start: token.start, 109 | line: token.line, 110 | column: token.column, 111 | raw: token.input, 112 | ), 113 | ); 114 | 115 | @override 116 | Parser paragraphBreak() => super.paragraphBreak().token().map( 117 | (token) => ParagraphBreak( 118 | start: token.start, 119 | line: token.line, 120 | column: token.column, 121 | raw: token.input, 122 | ), 123 | ); 124 | } 125 | -------------------------------------------------------------------------------- /lib/data/deserializer/petit/petit.dart: -------------------------------------------------------------------------------- 1 | export 'deserializer.dart'; 2 | -------------------------------------------------------------------------------- /lib/data/deserializer/quill/deserializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_quill/flutter_quill.dart' as quill; 2 | import 'package:groen/data/deserializer/deserializer.dart'; 3 | import 'package:groen/data/model/model.dart'; 4 | 5 | class DeltaDeserializer implements Deserializer { 6 | @override 7 | Node deserialize(quill.Delta input) => throw UnimplementedError(); 8 | } 9 | -------------------------------------------------------------------------------- /lib/data/deserializer/quill/quill.dart: -------------------------------------------------------------------------------- 1 | export 'deserializer.dart'; 2 | -------------------------------------------------------------------------------- /lib/data/model/attachedmod.dart: -------------------------------------------------------------------------------- 1 | import 'package:groen/data/string.dart'; 2 | 3 | import 'node.dart'; 4 | 5 | enum AttachedModType { 6 | bold, 7 | italic, 8 | underline, 9 | strikethrough, 10 | spoiler, 11 | superscript, 12 | subscript, 13 | inlineCode, 14 | inlineComment, 15 | // inlineMath, 16 | // variable, 17 | } 18 | 19 | const charByAttachedModType = { 20 | AttachedModType.bold: '*', 21 | AttachedModType.italic: '/', 22 | AttachedModType.underline: '_', 23 | AttachedModType.strikethrough: '-', 24 | AttachedModType.spoiler: '!', 25 | AttachedModType.superscript: '^', 26 | AttachedModType.subscript: ',', 27 | AttachedModType.inlineCode: '`', 28 | AttachedModType.inlineComment: '%', 29 | }; 30 | 31 | const attachedModTypeByChar = { 32 | '*': AttachedModType.bold, 33 | '/': AttachedModType.italic, 34 | '_': AttachedModType.underline, 35 | '-': AttachedModType.strikethrough, 36 | '!': AttachedModType.spoiler, 37 | '^': AttachedModType.superscript, 38 | ',': AttachedModType.subscript, 39 | '`': AttachedModType.inlineCode, 40 | '%': AttachedModType.inlineComment, 41 | }; 42 | 43 | final attachedModChars = Set.unmodifiable(attachedModTypeByChar.keys); 44 | 45 | extension AttachedModChar on AttachedModType { 46 | String get char => charByAttachedModType[this]!; 47 | int get charCode => char.codeUnit; 48 | } 49 | 50 | class AttachedModified extends Node { 51 | final AttachedModType type; 52 | final String text; 53 | 54 | const AttachedModified({ 55 | required this.type, 56 | required this.text, 57 | required super.start, 58 | required super.line, 59 | required super.column, 60 | required super.raw, 61 | }); 62 | 63 | @override 64 | List get props => super.props + [type, text]; 65 | } 66 | -------------------------------------------------------------------------------- /lib/data/model/document.dart: -------------------------------------------------------------------------------- 1 | import 'node.dart'; 2 | 3 | class Document extends Node { 4 | const Document({ 5 | required super.start, 6 | required super.line, 7 | required super.column, 8 | required super.raw, 9 | required super.children, 10 | }); 11 | 12 | const Document.empty() 13 | : this(start: 1, line: 1, column: 1, raw: '', children: const []); 14 | } 15 | -------------------------------------------------------------------------------- /lib/data/model/escaping.dart: -------------------------------------------------------------------------------- 1 | import 'node.dart'; 2 | 3 | class Escaping extends Node { 4 | final String escaped; 5 | 6 | const Escaping({ 7 | required this.escaped, 8 | required super.start, 9 | required super.line, 10 | required super.column, 11 | required super.raw, 12 | }); 13 | 14 | @override 15 | List get props => super.props + [escaped]; 16 | } 17 | -------------------------------------------------------------------------------- /lib/data/model/exception.dart: -------------------------------------------------------------------------------- 1 | class DeserializeException extends FormatException { 2 | const DeserializeException(String message) 3 | : super("Error while deserializing input: $message"); 4 | } 5 | 6 | class SerializeException extends FormatException { 7 | const SerializeException(String message) 8 | : super("Error while serializing input: $message"); 9 | } 10 | -------------------------------------------------------------------------------- /lib/data/model/linkable.dart: -------------------------------------------------------------------------------- 1 | import 'node.dart'; 2 | 3 | abstract class Link extends Node { 4 | final String location; 5 | final String? description; 6 | 7 | const Link({ 8 | required this.location, 9 | this.description, 10 | required super.start, 11 | required super.line, 12 | required super.column, 13 | required super.raw, 14 | }); 15 | 16 | @override 17 | List get props => super.props + [location, description]; 18 | } 19 | 20 | class Url extends Link { 21 | const Url({ 22 | required super.location, 23 | required super.start, 24 | required super.line, 25 | required super.column, 26 | required super.raw, 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /lib/data/model/model.dart: -------------------------------------------------------------------------------- 1 | export 'document.dart'; 2 | export 'linkable.dart'; 3 | export 'paragraph.dart'; 4 | export 'node.dart'; 5 | export 'text.dart'; 6 | export 'escaping.dart'; 7 | export 'attachedmod.dart'; 8 | -------------------------------------------------------------------------------- /lib/data/model/node.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class NodeVisitor { 4 | T visit(Node node); 5 | } 6 | 7 | abstract class Node extends Equatable { 8 | final int start; 9 | final int line; 10 | final int column; 11 | final String raw; 12 | final List? children; 13 | 14 | const Node({ 15 | required this.start, 16 | required this.line, 17 | required this.column, 18 | required this.raw, 19 | this.children, 20 | }); 21 | 22 | int get length => raw.length; 23 | 24 | int get stop => start + length; 25 | 26 | bool get isLeaf => children == null; 27 | 28 | T accept(NodeVisitor visitor) { 29 | return visitor.visit(this); 30 | } 31 | 32 | List acceptRecursively(NodeVisitor visitor) { 33 | return [this, ...children ?? const []] 34 | .map(visitor.visit) 35 | .toList(growable: false); 36 | } 37 | 38 | @override 39 | List get props => [start, line, column, raw, children]; 40 | 41 | @override 42 | bool? get stringify => true; 43 | } 44 | 45 | class Empty extends Node { 46 | const Empty({required int start, required int line, required int column}) 47 | : super(start: start, line: line, column: column, raw: ''); 48 | } 49 | -------------------------------------------------------------------------------- /lib/data/model/paragraph.dart: -------------------------------------------------------------------------------- 1 | import 'node.dart'; 2 | 3 | class Paragraph extends Node { 4 | const Paragraph({ 5 | required super.start, 6 | required super.line, 7 | required super.column, 8 | required super.raw, 9 | required super.children, 10 | }); 11 | } 12 | 13 | class ParagraphSegment extends Node { 14 | const ParagraphSegment({ 15 | required super.start, 16 | required super.line, 17 | required super.column, 18 | required super.raw, 19 | required super.children, 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /lib/data/model/text.dart: -------------------------------------------------------------------------------- 1 | import 'node.dart'; 2 | 3 | class PlainText extends Node { 4 | const PlainText({ 5 | required super.start, 6 | required super.line, 7 | required super.column, 8 | required super.raw, 9 | }); 10 | 11 | String get text => raw; 12 | } 13 | 14 | class Whitespace extends Node { 15 | const Whitespace({ 16 | required super.start, 17 | required super.line, 18 | required super.column, 19 | required super.raw, 20 | }); 21 | 22 | // @override 23 | // String toString() => _invisibleToString(this); 24 | } 25 | 26 | class LineEnding extends Node { 27 | const LineEnding({ 28 | required super.start, 29 | required super.line, 30 | required super.column, 31 | required super.raw, 32 | }); 33 | 34 | @override 35 | String toString() => _invisibleToString(this); 36 | } 37 | 38 | class ParagraphBreak extends Node { 39 | const ParagraphBreak({ 40 | required super.start, 41 | required super.line, 42 | required super.column, 43 | required super.raw, 44 | }); 45 | 46 | @override 47 | String toString() => _invisibleToString(this); 48 | } 49 | 50 | String _invisibleToString(Node node) => 51 | '${node.runtimeType}(${node.start}, ${node.line}, ${node.column}, ${node.raw.codeUnits.map((c) => "U+$c")}, null)'; 52 | -------------------------------------------------------------------------------- /lib/data/serializer/quill/node.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_quill/flutter_quill.dart' as quill; 2 | 3 | import 'package:groen/data/model/exception.dart'; 4 | import 'package:groen/data/model/model.dart'; 5 | import 'package:groen/data/serializer/serializer.dart'; 6 | 7 | abstract class NodeDeltaSerializer 8 | implements Serializer { 9 | const NodeDeltaSerializer(); 10 | 11 | quill.Delta serializeNode(T node); 12 | 13 | @override 14 | quill.Delta serialize(Node node) { 15 | if (node is! T) { 16 | throw SerializeException('Node is not a ${T.runtimeType}: $node'); 17 | } 18 | return serializeNode(node); 19 | } 20 | } 21 | 22 | const nodeSerializerByType = { 23 | Document: DocumentDeltaSerializer(), 24 | Paragraph: ParagraphDeltaSerializer(), 25 | ParagraphSegment: ParagraphSegmentDeltaSerializer(), 26 | Url: UrlDeltaSerializer(), 27 | AttachedModified: AttachedModDeltaSerializer(), 28 | }; 29 | 30 | quill.Delta serializeChildren(Node node) => node.children! 31 | .map(serializeWithFallback) 32 | .reduce((delta1, delta2) => delta1.concat(delta2)); 33 | 34 | quill.Delta serializeWithFallback(Node node) { 35 | final serializer = nodeSerializerByType[node.runtimeType]; 36 | if (serializer != null) { 37 | return serializer.serialize(node); 38 | } 39 | return quill.Delta()..insert(node.raw); 40 | } 41 | 42 | class DocumentDeltaSerializer extends NodeDeltaSerializer { 43 | const DocumentDeltaSerializer(); 44 | 45 | @override 46 | quill.Delta serializeNode(Document node) => serializeChildren(node); 47 | } 48 | 49 | class ParagraphDeltaSerializer extends NodeDeltaSerializer { 50 | const ParagraphDeltaSerializer(); 51 | 52 | @override 53 | quill.Delta serializeNode(Paragraph node) => serializeChildren(node); 54 | } 55 | 56 | class ParagraphSegmentDeltaSerializer 57 | extends NodeDeltaSerializer { 58 | const ParagraphSegmentDeltaSerializer(); 59 | 60 | @override 61 | quill.Delta serializeNode(ParagraphSegment node) => serializeChildren(node); 62 | } 63 | 64 | class UrlDeltaSerializer extends NodeDeltaSerializer { 65 | const UrlDeltaSerializer(); 66 | 67 | @override 68 | quill.Delta serializeNode(Url node) => 69 | quill.Delta()..insert(node.raw, {'link': node.location}); 70 | } 71 | 72 | class AttachedModDeltaSerializer extends NodeDeltaSerializer { 73 | const AttachedModDeltaSerializer(); 74 | 75 | @override 76 | quill.Delta serializeNode(AttachedModified node) { 77 | switch (node.type) { 78 | case AttachedModType.bold: 79 | return serializeBold(node); 80 | case AttachedModType.italic: 81 | return serializeItalic(node); 82 | case AttachedModType.underline: 83 | return serializeUnderline(node); 84 | case AttachedModType.strikethrough: 85 | return serializeStrikethrough(node); 86 | case AttachedModType.inlineCode: 87 | return serializeInlineCode(node); 88 | case AttachedModType.subscript: 89 | return serializeSubscript(node); 90 | case AttachedModType.superscript: 91 | return serializeSuperscript(node); 92 | 93 | default: 94 | return serializeUnknownType(node); 95 | } 96 | } 97 | 98 | quill.Delta serializeBold(AttachedModified node) => 99 | quill.Delta()..insert(node.raw, {'bold': true}); 100 | 101 | quill.Delta serializeItalic(AttachedModified node) => 102 | quill.Delta()..insert(node.raw, {'italic': true}); 103 | 104 | quill.Delta serializeUnderline(AttachedModified node) => 105 | quill.Delta()..insert(node.raw, {'underline': true}); 106 | 107 | quill.Delta serializeStrikethrough(AttachedModified node) => 108 | quill.Delta()..insert(node.raw, {'strike': true}); 109 | 110 | quill.Delta serializeInlineCode(AttachedModified node) => 111 | quill.Delta()..insert(node.raw, {'code': true}); 112 | 113 | quill.Delta serializeSubscript(AttachedModified node) => 114 | quill.Delta()..insert(node.raw, {'small': true}); 115 | 116 | quill.Delta serializeSuperscript(AttachedModified node) => 117 | quill.Delta()..insert(node.raw, {'size': 'huge'}); 118 | 119 | quill.Delta serializeUnknownType(AttachedModified node) => 120 | quill.Delta()..insert(node.text); 121 | } 122 | -------------------------------------------------------------------------------- /lib/data/serializer/quill/quill.dart: -------------------------------------------------------------------------------- 1 | export 'serializer.dart'; 2 | -------------------------------------------------------------------------------- /lib/data/serializer/quill/serializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_quill/flutter_quill.dart' as quill; 2 | 3 | import 'package:groen/data/model/model.dart'; 4 | import 'package:groen/data/serializer/serializer.dart'; 5 | 6 | import 'node.dart'; 7 | 8 | class QuillDeltaSerializer implements Serializer { 9 | const QuillDeltaSerializer(); 10 | 11 | @override 12 | quill.Delta serialize(Node node) => serializeWithFallback(node); 13 | } 14 | -------------------------------------------------------------------------------- /lib/data/serializer/serializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:groen/data/model/model.dart'; 2 | 3 | export 'quill/quill.dart'; 4 | 5 | abstract class Serializer { 6 | T serialize(Node node); 7 | } 8 | -------------------------------------------------------------------------------- /lib/data/serializer/text/serializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:groen/data/model/model.dart'; 2 | import 'package:groen/data/serializer/serializer.dart'; 3 | 4 | class StringSerializer implements Serializer { 5 | @override 6 | String serialize(Node node) => node.raw; 7 | } 8 | -------------------------------------------------------------------------------- /lib/data/serializer/text/text.dart: -------------------------------------------------------------------------------- 1 | export 'serializer.dart'; 2 | -------------------------------------------------------------------------------- /lib/data/string.dart: -------------------------------------------------------------------------------- 1 | extension NullOrEmpty on String? { 2 | bool get isNullOrEmpty => this?.isEmpty ?? true; 3 | } 4 | 5 | extension CodeUnit on String { 6 | int get codeUnit { 7 | if (codeUnits.length > 1) { 8 | ArgumentError.value("The string $this has more code units than 1"); 9 | } 10 | return codeUnitAt(0); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:get/get.dart'; 5 | import 'package:groen/ui/list_page.dart'; 6 | import 'package:groen/ui/settings_page.dart'; 7 | import 'package:groen/ui/two_state_future_builder.dart'; 8 | import 'package:permission_handler/permission_handler.dart'; 9 | import 'package:shared_preferences/shared_preferences.dart'; 10 | 11 | void main() { 12 | runApp(const GroenApp()); 13 | } 14 | 15 | class GroenApp extends StatelessWidget { 16 | const GroenApp({super.key}); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return GetMaterialApp( 21 | title: 'Groen', 22 | theme: ThemeData( 23 | primarySwatch: Colors.blue, 24 | ), 25 | home: FutureBuilder( 26 | future: Permission.manageExternalStorage.isGranted, 27 | builder: (context, grantedSnapshot) { 28 | if (!Platform.isLinux && !grantedSnapshot.hasData) { 29 | return const Text('loading'); 30 | } 31 | if (Platform.isLinux || (grantedSnapshot.data ?? false)) { 32 | return buildApp(); 33 | } else { 34 | return TwoStateFutureBuilder( 35 | future: Permission.manageExternalStorage.request(), 36 | builder: (context, status) { 37 | if (status.isDenied || status.isPermanentlyDenied) { 38 | return const Text('nothing to do'); 39 | } 40 | return buildApp(); 41 | }, 42 | ); 43 | } 44 | }, 45 | ), 46 | ); 47 | } 48 | 49 | FutureBuilder buildApp() { 50 | return FutureBuilder( 51 | future: SharedPreferences.getInstance(), 52 | builder: (context, prefsSnapshot) { 53 | if (!prefsSnapshot.hasData || prefsSnapshot.data == null) { 54 | return const CircularProgressIndicator(); 55 | } 56 | final prefs = prefsSnapshot.data!; 57 | if (prefs.getString('root_directory') == null) { 58 | return const SettingsPage(); 59 | } 60 | return const ListPage(); 61 | }, 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/ui/editor/screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/src/widgets/framework.dart'; 2 | import 'package:flutter/src/widgets/placeholder.dart'; 3 | 4 | class EditorScreen extends StatelessWidget { 5 | const EditorScreen({super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return const Placeholder(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/ui/editor/viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'package:groen/data/model/model.dart' hide Document; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_quill/flutter_quill.dart' hide Node; 4 | import 'package:groen/data/serializer/serializer.dart'; 5 | 6 | abstract class EditorViewModel { 7 | String toPlainText(); 8 | Function(String content)? onContentChanged; 9 | void render(Node node, {bool skipOnChange = false}); 10 | } 11 | 12 | class QuillEditorViewModel with ChangeNotifier implements EditorViewModel { 13 | final QuillController controller; 14 | final QuillDeltaSerializer serializer; 15 | @override 16 | Function(String content)? onContentChanged; 17 | Delta? _currentDelta; 18 | TextSelection? _currentTextSelection; 19 | bool _shouldSkipOnChange = false; 20 | 21 | QuillEditorViewModel({ 22 | required this.controller, 23 | required this.serializer, 24 | this.onContentChanged, 25 | }) { 26 | controller.addListener(_onChange); 27 | } 28 | 29 | void _onChange() { 30 | if (_shouldSkipOnChange) { 31 | return; 32 | } 33 | if (controller.document.toDelta() != _currentDelta) { 34 | onContentChanged?.call(controller.document.toPlainText()); 35 | _currentDelta = controller.document.toDelta(); 36 | } 37 | if (controller.selection == _currentTextSelection) { 38 | // TODO: implement on text selection changed 39 | } 40 | } 41 | 42 | @override 43 | void render(Node node, {bool skipOnChange = false}) { 44 | _shouldSkipOnChange = skipOnChange; 45 | final delta = serializer.serialize(node); 46 | print('delta:$delta'); 47 | print(controller); 48 | final prevSelection = controller.selection; 49 | controller.document = Document.fromDelta(delta); 50 | controller.updateSelection(prevSelection, ChangeSource.LOCAL); 51 | print('da'); 52 | _shouldSkipOnChange = false; 53 | } 54 | 55 | @override 56 | String toPlainText() => controller.document.toPlainText(); 57 | } 58 | -------------------------------------------------------------------------------- /lib/ui/editor_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:file_picker/file_picker.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_quill/flutter_quill.dart' as quill; 6 | import 'package:flutter_quill_extensions/flutter_quill_extensions.dart'; 7 | import 'package:get/get.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | import 'editor_view_model.dart'; 11 | import 'settings_page.dart'; 12 | 13 | class EditorPage extends StatelessWidget { 14 | final File file; 15 | 16 | const EditorPage({super.key, required this.file}); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return ChangeNotifierProvider( 21 | create: (context) => EditorViewModel(file: file), 22 | builder: (context, child) => Scaffold( 23 | appBar: AppBar( 24 | title: const Text('groen'), 25 | actions: [ 26 | Padding( 27 | padding: const EdgeInsets.only(right: 20.0), 28 | child: GestureDetector( 29 | onTap: () async => context.read().save(), 30 | child: const Icon(Icons.save, size: 26.0), 31 | ), 32 | ), 33 | Padding( 34 | padding: const EdgeInsets.only(right: 20.0), 35 | child: GestureDetector( 36 | onTap: () => Get.to(const SettingsPage()), 37 | child: const Icon(Icons.more_vert), 38 | ), 39 | ), 40 | ], 41 | ), 42 | body: SafeArea( 43 | child: createQuillEditor(context), 44 | ), 45 | ), 46 | ); 47 | } 48 | 49 | Widget createQuillEditor(BuildContext context) { 50 | return Column( 51 | children: [ 52 | quill.QuillToolbar.basic( 53 | controller: context.read().quillController, 54 | showDividers: true, 55 | showFontFamily: false, 56 | showSmallButton: true, 57 | showAlignmentButtons: false, 58 | embedButtons: FlutterQuillEmbeds.buttons( 59 | showFormulaButton: true, 60 | // mediaPickSettingSelector: (context) async => 61 | // MediaPickSetting.Gallery, 62 | onImagePickCallback: (file) async => 'imagee', 63 | onVideoPickCallback: (file) async => 'videoo', 64 | filePickImpl: (context) => FilePicker.platform 65 | .pickFiles() 66 | .then((value) => value?.paths[0]), 67 | ), 68 | ), 69 | Expanded( 70 | child: quill.QuillEditor.basic( 71 | controller: context.read().quillController, 72 | embedBuilders: FlutterQuillEmbeds.builders(), 73 | readOnly: false, 74 | ), 75 | ) 76 | ], 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/ui/editor_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:get/get.dart'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_quill/flutter_quill.dart'; 6 | import 'package:groen/data/deserializer/petit/parser.dart'; 7 | import 'package:groen/data/deserializer/petit/petit.dart'; 8 | import 'package:groen/data/model/model.dart' as norg; 9 | import 'package:groen/data/serializer/quill/serializer.dart'; 10 | import 'package:groen/ui/editor/viewmodel.dart'; 11 | import 'package:petitparser/debug.dart'; 12 | 13 | class EditorViewModel with ChangeNotifier { 14 | final QuillController quillController; 15 | late QuillEditorViewModel quillEditorViewModel; 16 | File? file; 17 | String coco = ''; 18 | 19 | EditorViewModel({this.file}) : quillController = QuillController.basic() { 20 | Future.microtask(() => _populateController()); 21 | } 22 | 23 | Future save() async { 24 | if (file == null) { 25 | return; 26 | } 27 | Get.snackbar("Saved", "Saved ${file?.path}"); 28 | final content = quillController.document.toPlainText(); 29 | await file?.writeAsString(content); 30 | } 31 | 32 | Future _populateController() async { 33 | if (file != null) { 34 | var content = await file!.readAsString(); 35 | norg.Node node = const norg.Document.empty(); 36 | final deserializer = PetitDeserializer(const NorgParser().build()); 37 | node = deserializer.deserialize(content); 38 | quillEditorViewModel = QuillEditorViewModel( 39 | controller: quillController, 40 | serializer: const QuillDeltaSerializer(), 41 | onContentChanged: (content) { 42 | final node = deserializer.deserialize(content); 43 | quillEditorViewModel.render(node, skipOnChange: true); 44 | }, 45 | )..render(node); 46 | } 47 | // if (content == coco) { 48 | // return; 49 | // } 50 | // coco = content; 51 | // norg.Node node = const norg.Document.empty(); 52 | // try { 53 | // final deserializer = PetitDeserializer(const NorgParser().build()); 54 | // node = deserializer.deserialize(content); 55 | // } catch (e) { 56 | // print('can not deserialize: $e'); 57 | // } 58 | // try { 59 | // final delta = QuillDeltaSerializer().serialize(node); 60 | // debugPrint(delta.toJson().toString()); 61 | // quillController.document = Document.fromDelta(delta); 62 | // } catch (e) { 63 | // print('can not serialize: $e'); 64 | // 65 | // quillController.document = Document()..insert(0, content); 66 | // } 67 | // }); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/ui/list_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | import 'package:groen/ui/editor_page.dart'; 4 | import 'package:groen/ui/settings_page.dart'; 5 | import 'package:groen/ui/two_state_future_builder.dart'; 6 | import 'package:shared_preferences/shared_preferences.dart'; 7 | import 'dart:io'; 8 | import 'package:path/path.dart' as path; 9 | 10 | class ListPage extends StatefulWidget { 11 | const ListPage({Key? key}) : super(key: key); 12 | 13 | @override 14 | State createState() => _ListPageState(); 15 | } 16 | 17 | class _ListPageState extends State { 18 | @override 19 | Widget build(BuildContext context) { 20 | return Scaffold( 21 | appBar: AppBar( 22 | title: const Text('groen'), 23 | actions: [ 24 | Padding( 25 | padding: const EdgeInsets.only(right: 20.0), 26 | child: GestureDetector( 27 | onTap: () {}, 28 | child: const Icon( 29 | Icons.search, 30 | size: 26.0, 31 | ), 32 | ), 33 | ), 34 | Padding( 35 | padding: const EdgeInsets.only(right: 20.0), 36 | child: GestureDetector( 37 | onTap: () => Get.to(const SettingsPage()), 38 | child: const Icon(Icons.more_vert), 39 | ), 40 | ), 41 | ], 42 | ), 43 | body: FutureBuilder( 44 | future: SharedPreferences.getInstance(), 45 | builder: (context, prefsSnapshot) { 46 | if (!prefsSnapshot.hasData) { 47 | return const CircularProgressIndicator(); 48 | } 49 | final rootDir = prefsSnapshot.data?.getString("root_directory"); 50 | if (rootDir == null) { 51 | return const Text("no root dir"); 52 | } 53 | return TwoStateFutureBuilder>( 54 | future: Directory(rootDir).list().toList(), 55 | builder: (context, files) { 56 | return ListView.builder( 57 | itemCount: files.length, 58 | itemBuilder: (context, index) { 59 | final file = files[index]; 60 | return TextButton( 61 | onPressed: () async { 62 | Get.to(EditorPage(file: File(file.path))); 63 | }, 64 | child: Text(path.split(file.path).last), 65 | ); 66 | }, 67 | ); 68 | }, 69 | fallback: (_) { 70 | print("fallback"); 71 | return const Text('Loading...'); 72 | }, 73 | ); 74 | }, 75 | ), 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/ui/settings_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:file_picker/file_picker.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:get/get.dart'; 4 | import 'package:shared_preferences/shared_preferences.dart'; 5 | 6 | const rootDirKey = 'root_directory'; 7 | 8 | class SettingsPage extends StatefulWidget { 9 | const SettingsPage({Key? key}) : super(key: key); 10 | 11 | @override 12 | State createState() => _SettingsPageState(); 13 | } 14 | 15 | class _SettingsPageState extends State { 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: AppBar(title: const Text('Settings')), 20 | body: Center( 21 | child: FutureBuilder( 22 | future: SharedPreferences.getInstance(), 23 | builder: (context, prefsSnapshot) { 24 | if (!prefsSnapshot.hasData || prefsSnapshot.data == null) { 25 | return const CircularProgressIndicator(); 26 | } 27 | final prefs = prefsSnapshot.data!; 28 | return Column( 29 | children: [ 30 | Text(prefs.getString(rootDirKey) ?? 'no root dir'), 31 | ElevatedButton( 32 | onPressed: () async { 33 | String? path; 34 | try { 35 | path = await FilePicker.platform.getDirectoryPath(); 36 | } catch (e) { 37 | Get.snackbar('Can not select path', e.toString()); 38 | } 39 | if (path == null) { 40 | return; 41 | } 42 | await prefs.setString(rootDirKey, path); 43 | setState(() {}); 44 | }, 45 | child: const Text('select dir'), 46 | ), 47 | ], 48 | ); 49 | }, 50 | ), 51 | ), 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/ui/two_state_future_builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// [FutureBuilder] with just two states that the generic type [T] does exist or not. 4 | /// If [T] does not exist, the [fallback] builder will be called if it is not null. 5 | class TwoStateFutureBuilder extends StatelessWidget { 6 | final Widget Function(BuildContext, T) builder; 7 | final Future future; 8 | final Widget Function(BuildContext)? fallback; 9 | 10 | const TwoStateFutureBuilder({ 11 | super.key, 12 | required this.builder, 13 | required this.future, 14 | this.fallback, 15 | }); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | final finalFallback = fallback ?? _buildEmpty; 20 | 21 | return FutureBuilder( 22 | future: future, 23 | builder: ((context, snapshot) => _isBuildable(snapshot) 24 | // ignore: null_check_on_nullable_type_parameter 25 | ? builder(context, snapshot.data!) 26 | : finalFallback(context)), 27 | ); 28 | } 29 | 30 | bool _isBuildable(AsyncSnapshot snapshot) => 31 | snapshot.hasData && snapshot.data != null; 32 | 33 | Widget _buildEmpty(BuildContext _) => const SizedBox.shrink(); 34 | } 35 | -------------------------------------------------------------------------------- /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 "groen") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.nacro90.groen") 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) pasteboard_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin"); 15 | pasteboard_plugin_register_with_registrar(pasteboard_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 | pasteboard 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, "groen"); 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, "groen"); 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? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import device_info_plus 9 | import pasteboard 10 | import path_provider_foundation 11 | import shared_preferences_foundation 12 | import url_launcher_macos 13 | 14 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 15 | DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) 16 | PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) 17 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 18 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 19 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 20 | } 21 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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 = groen 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.nacro90.groen 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.nacro90.groen. 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: groen 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 is 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 | # In Windows, build-name is used as the major, minor, and patch parts 19 | # of the product and file versions while build-number is used as the build suffix. 20 | version: 1.0.0+1 21 | 22 | environment: 23 | sdk: '>=2.18.2 <3.0.0' 24 | 25 | # Dependencies specify other packages that your package needs in order to work. 26 | # To automatically upgrade your package dependencies to the latest versions 27 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 28 | # dependencies can be manually updated by changing the version numbers below to 29 | # the latest version available on pub.dev. To see which dependencies have newer 30 | # versions available, run `flutter pub outdated`. 31 | dependencies: 32 | flutter: 33 | sdk: flutter 34 | 35 | 36 | # The following adds the Cupertino Icons font to your application. 37 | # Use with the CupertinoIcons class for iOS style icons. 38 | cupertino_icons: ^1.0.2 39 | petitparser: ^5.1.0 40 | flutter_quill: ^7.0.1 41 | url_launcher: ^6.1.6 42 | shared_preferences: ^2.0.15 43 | file_picker: ^5.2.2 44 | path_provider: ^2.0.11 45 | get: ^4.6.5 46 | permission_handler: ^10.2.0 47 | get_it: ^7.2.0 48 | provider: ^6.0.4 49 | equatable: ^2.0.5 50 | charcode: ^1.3.1 51 | mockito: ^5.4.0 52 | build_runner: ^2.3.3 53 | flutter_quill_extensions: ^0.2.0 54 | 55 | dev_dependencies: 56 | flutter_test: 57 | sdk: flutter 58 | 59 | # The "flutter_lints" package below contains a set of recommended lints to 60 | # encourage good coding practices. The lint set provided by the package is 61 | # activated in the `analysis_options.yaml` file located at the root of your 62 | # package. See that file for information about deactivating specific lint 63 | # rules and activating additional ones. 64 | flutter_lints: ^2.0.0 65 | dart_code_metrics: ^5.6.0 66 | 67 | # For information on the generic Dart part of this file, see the 68 | # following page: https://dart.dev/tools/pub/pubspec 69 | 70 | # The following section is specific to Flutter packages. 71 | flutter: 72 | 73 | # The following line ensures that the Material Icons font is 74 | # included with your application, so that you can use the icons in 75 | # the material Icons class. 76 | uses-material-design: true 77 | 78 | # To add assets to your application, add an assets section, like this: 79 | # assets: 80 | # - images/a_dot_burr.jpeg 81 | # - images/a_dot_ham.jpeg 82 | 83 | # An image asset can refer to one or more resolution-specific "variants", see 84 | # https://flutter.dev/assets-and-images/#resolution-aware 85 | 86 | # For details regarding adding assets from package dependencies, see 87 | # https://flutter.dev/assets-and-images/#from-packages 88 | 89 | # To add custom fonts to your application, add a fonts section here, 90 | # in this "flutter" section. Each entry in this list should have a 91 | # "family" key with the font family name, and a "fonts" key with a 92 | # list giving the asset and other descriptors for the font. For 93 | # example: 94 | # fonts: 95 | # - family: Schyler 96 | # fonts: 97 | # - asset: fonts/Schyler-Regular.ttf 98 | # - asset: fonts/Schyler-Italic.ttf 99 | # style: italic 100 | # - family: Trajan Pro 101 | # fonts: 102 | # - asset: fonts/TrajanPro.ttf 103 | # - asset: fonts/TrajanPro_Bold.ttf 104 | # weight: 700 105 | # 106 | # For details regarding fonts from package dependencies, 107 | # see https://flutter.dev/custom-fonts/#from-packages 108 | -------------------------------------------------------------------------------- /test/core/deserializer/petit/deserializer_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:groen/data/deserializer/petit/petit.dart'; 3 | import 'package:groen/data/model/exception.dart'; 4 | import 'package:groen/data/model/model.dart'; 5 | import 'package:mockito/annotations.dart'; 6 | import 'package:mockito/mockito.dart'; 7 | import 'package:petitparser/petitparser.dart'; 8 | 9 | @GenerateNiceMocks([ 10 | MockSpec(unsupportedMembers: {#captureResultGeneric}) 11 | ]) 12 | import 'deserializer_test.mocks.dart'; 13 | 14 | void main() { 15 | group('PetitDeserializer', () { 16 | test('successful parse', () { 17 | final parser = MockParser(); 18 | const success = Success('', 0, Document.empty()); 19 | when(parser.parse('')).thenReturn(success); 20 | final deserializer = PetitDeserializer(parser); 21 | 22 | final actual = deserializer.deserialize(''); 23 | 24 | expect(actual, const Document.empty()); 25 | }); 26 | 27 | test('parse failure', () { 28 | final parser = MockParser(); 29 | const failure = Failure('', 0, 'parse error msg'); 30 | when(parser.parse('')).thenReturn(failure); 31 | final deserializer = PetitDeserializer(parser); 32 | 33 | expect(() => deserializer.deserialize(''), 34 | throwsA(isA())); 35 | }); 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /test/core/deserializer/petit/deserializer_test.mocks.dart: -------------------------------------------------------------------------------- 1 | // Mocks generated by Mockito 5.4.0 from annotations 2 | // in groen/test/core/deserializer/petit/deserializer_test.dart. 3 | // Do not manually edit this file. 4 | 5 | // ignore_for_file: no_leading_underscores_for_library_prefixes 6 | import 'package:mockito/mockito.dart' as _i1; 7 | import 'package:petitparser/src/context/context.dart' as _i4; 8 | import 'package:petitparser/src/context/result.dart' as _i2; 9 | import 'package:petitparser/src/core/parser.dart' as _i3; 10 | 11 | // ignore_for_file: type=lint 12 | // ignore_for_file: avoid_redundant_argument_values 13 | // ignore_for_file: avoid_setters_without_getters 14 | // ignore_for_file: comment_references 15 | // ignore_for_file: implementation_imports 16 | // ignore_for_file: invalid_use_of_visible_for_testing_member 17 | // ignore_for_file: prefer_const_constructors 18 | // ignore_for_file: unnecessary_parenthesis 19 | // ignore_for_file: camel_case_types 20 | // ignore_for_file: subtype_of_sealed_class 21 | 22 | class _FakeResult_0 extends _i1.SmartFake implements _i2.Result { 23 | _FakeResult_0( 24 | Object parent, 25 | Invocation parentInvocation, 26 | ) : super( 27 | parent, 28 | parentInvocation, 29 | ); 30 | } 31 | 32 | class _FakeParser_1 extends _i1.SmartFake implements _i3.Parser { 33 | _FakeParser_1( 34 | Object parent, 35 | Invocation parentInvocation, 36 | ) : super( 37 | parent, 38 | parentInvocation, 39 | ); 40 | } 41 | 42 | /// A class which mocks [Parser]. 43 | /// 44 | /// See the documentation for Mockito's code generation for more information. 45 | class MockParser extends _i1.Mock implements _i3.Parser { 46 | @override 47 | List<_i3.Parser> get children => (super.noSuchMethod( 48 | Invocation.getter(#children), 49 | returnValue: <_i3.Parser>[], 50 | returnValueForMissingStub: <_i3.Parser>[], 51 | ) as List<_i3.Parser>); 52 | @override 53 | _i2.Result parseOn(_i4.Context? context) => (super.noSuchMethod( 54 | Invocation.method( 55 | #parseOn, 56 | [context], 57 | ), 58 | returnValue: _FakeResult_0( 59 | this, 60 | Invocation.method( 61 | #parseOn, 62 | [context], 63 | ), 64 | ), 65 | returnValueForMissingStub: _FakeResult_0( 66 | this, 67 | Invocation.method( 68 | #parseOn, 69 | [context], 70 | ), 71 | ), 72 | ) as _i2.Result); 73 | @override 74 | int fastParseOn( 75 | String? buffer, 76 | int? position, 77 | ) => 78 | (super.noSuchMethod( 79 | Invocation.method( 80 | #fastParseOn, 81 | [ 82 | buffer, 83 | position, 84 | ], 85 | ), 86 | returnValue: 0, 87 | returnValueForMissingStub: 0, 88 | ) as int); 89 | @override 90 | _i2.Result parse(String? input) => (super.noSuchMethod( 91 | Invocation.method( 92 | #parse, 93 | [input], 94 | ), 95 | returnValue: _FakeResult_0( 96 | this, 97 | Invocation.method( 98 | #parse, 99 | [input], 100 | ), 101 | ), 102 | returnValueForMissingStub: _FakeResult_0( 103 | this, 104 | Invocation.method( 105 | #parse, 106 | [input], 107 | ), 108 | ), 109 | ) as _i2.Result); 110 | @override 111 | _i3.Parser copy() => (super.noSuchMethod( 112 | Invocation.method( 113 | #copy, 114 | [], 115 | ), 116 | returnValue: _FakeParser_1( 117 | this, 118 | Invocation.method( 119 | #copy, 120 | [], 121 | ), 122 | ), 123 | returnValueForMissingStub: _FakeParser_1( 124 | this, 125 | Invocation.method( 126 | #copy, 127 | [], 128 | ), 129 | ), 130 | ) as _i3.Parser); 131 | @override 132 | bool isEqualTo( 133 | _i3.Parser? other, [ 134 | Set<_i3.Parser>? seen, 135 | ]) => 136 | (super.noSuchMethod( 137 | Invocation.method( 138 | #isEqualTo, 139 | [ 140 | other, 141 | seen, 142 | ], 143 | ), 144 | returnValue: false, 145 | returnValueForMissingStub: false, 146 | ) as bool); 147 | @override 148 | bool hasEqualProperties(_i3.Parser? other) => (super.noSuchMethod( 149 | Invocation.method( 150 | #hasEqualProperties, 151 | [other], 152 | ), 153 | returnValue: false, 154 | returnValueForMissingStub: false, 155 | ) as bool); 156 | @override 157 | bool hasEqualChildren( 158 | _i3.Parser? other, 159 | Set<_i3.Parser>? seen, 160 | ) => 161 | (super.noSuchMethod( 162 | Invocation.method( 163 | #hasEqualChildren, 164 | [ 165 | other, 166 | seen, 167 | ], 168 | ), 169 | returnValue: false, 170 | returnValueForMissingStub: false, 171 | ) as bool); 172 | @override 173 | void replace( 174 | _i3.Parser? source, 175 | _i3.Parser? target, 176 | ) => 177 | super.noSuchMethod( 178 | Invocation.method( 179 | #replace, 180 | [ 181 | source, 182 | target, 183 | ], 184 | ), 185 | returnValueForMissingStub: null, 186 | ); 187 | @override 188 | T captureResultGeneric(T Function(_i3.Parser)? callback) => 189 | throw UnsupportedError( 190 | r'"captureResultGeneric" cannot be used without a mockito fallback generator.'); 191 | } 192 | -------------------------------------------------------------------------------- /test/core/deserializer/petit/grammar_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:groen/data/deserializer/petit/grammar.dart'; 3 | import 'package:petitparser/debug.dart'; 4 | import 'package:petitparser/petitparser.dart'; 5 | import 'package:petitparser/reflection.dart'; 6 | 7 | bool Function(String) accept(Parser parser, {bool tracing = false}) => 8 | (input) => (tracing ? trace(parser) : parser).parse(input).isSuccess; 9 | 10 | void main() { 11 | group('NorgGrammar', () { 12 | late NorgGrammar grammar; 13 | late Parser parser; 14 | setUp(() { 15 | grammar = const NorgGrammar(); 16 | parser = grammar.build(); 17 | }); 18 | test('should detect common problems', () { 19 | expect(linter(parser), isEmpty); 20 | }); 21 | group('units', () { 22 | group('attached modifiers', () { 23 | test('bold', () { 24 | final parser = grammar.build(start: grammar.bold).end(); 25 | expect('*bold*', accept(parser)); 26 | expect('*bold with whitespace*', accept(parser)); 27 | expect('*bold with\nnewline*', accept(parser)); 28 | expect('*bold with\n\nnewline*', isNot(accept(parser))); 29 | expect('**', isNot(accept(parser))); 30 | expect('* succeded whitespace*', isNot(accept(parser))); 31 | expect('*preceded whitespace *', isNot(accept(parser))); 32 | expect('c*preceded whitespace *', isNot(accept(parser))); 33 | }); 34 | test('italic', () { 35 | final parser = grammar.build(start: grammar.italic).end(); 36 | expect('/italic/', accept(parser)); 37 | expect('/italic with whitespace/', accept(parser)); 38 | expect('/italic with\nnewline/', accept(parser)); 39 | expect('/italic with\n\nnewline/', isNot(accept(parser))); 40 | expect('//', isNot(accept(parser))); 41 | expect('/ succeded whitespace/', isNot(accept(parser))); 42 | expect('/preceded whitespace /', isNot(accept(parser))); 43 | }); 44 | test('underline', () { 45 | final parser = grammar.build(start: grammar.underline).end(); 46 | expect('_underline_', accept(parser)); 47 | expect('_underline with whitespace_', accept(parser)); 48 | expect('_underline with\nnewline_', accept(parser)); 49 | expect('_underline with\n\nnewline_', isNot(accept(parser))); 50 | expect('__', isNot(accept(parser))); 51 | expect('_ succeded whitespace_', isNot(accept(parser))); 52 | expect('_preceded whitespace _', isNot(accept(parser))); 53 | }); 54 | test('strikethrough', () { 55 | final parser = grammar.build(start: grammar.strikethrough).end(); 56 | expect('-strikethrough-', accept(parser)); 57 | expect('-strikethrough with whitespace-', accept(parser)); 58 | expect('-strikethrough with\nnewline-', accept(parser)); 59 | expect('-strikethrough with\n\nnewline-', isNot(accept(parser))); 60 | expect('--', isNot(accept(parser))); 61 | expect('- succeded whitespace-', isNot(accept(parser))); 62 | expect('-preceded whitespace -', isNot(accept(parser))); 63 | }); 64 | test('spoiler', () { 65 | final parser = grammar.build(start: grammar.spoiler).end(); 66 | expect('!spoiler!', accept(parser)); 67 | expect('!spoiler with whitespace!', accept(parser)); 68 | expect('!spoiler with\nnewline!', accept(parser)); 69 | expect('!spoiler with\n\nnewline!', isNot(accept(parser))); 70 | expect('!!', isNot(accept(parser))); 71 | expect('! succeded whitespace!', isNot(accept(parser))); 72 | expect('!preceded whitespace !', isNot(accept(parser))); 73 | }); 74 | test('superscript', () { 75 | final parser = grammar.build(start: grammar.superscript).end(); 76 | expect('^superscript^', accept(parser)); 77 | expect('^superscript with whitespace^', accept(parser)); 78 | expect('^superscript with\nnewline^', accept(parser)); 79 | expect('^superscript with\n\nnewline^', isNot(accept(parser))); 80 | expect('^^', isNot(accept(parser))); 81 | expect('^ succeded whitespace^', isNot(accept(parser))); 82 | expect('^preceded whitespace ^', isNot(accept(parser))); 83 | }); 84 | test('subscript', () { 85 | final parser = grammar.build(start: grammar.subscript).end(); 86 | expect(',subscript,', accept(parser)); 87 | expect(',subscript with whitespace,', accept(parser)); 88 | expect(',subscript with\nnewline,', accept(parser)); 89 | expect(',subscript with\n\nnewline,', isNot(accept(parser))); 90 | expect(',,', isNot(accept(parser))); 91 | expect(', succeded whitespace,', isNot(accept(parser))); 92 | expect(',preceded whitespace ,', isNot(accept(parser))); 93 | }); 94 | test('inlineCode', () { 95 | final parser = grammar.build(start: grammar.inlineCode).end(); 96 | expect('`inlineCode`', accept(parser)); 97 | expect('`inlineCode with whitespace`', accept(parser)); 98 | expect('`inlineCode with\nnewline`', accept(parser)); 99 | expect('`inlineCode with\n\nnewline`', isNot(accept(parser))); 100 | expect('``', isNot(accept(parser))); 101 | expect('` succeded whitespace`', isNot(accept(parser))); 102 | expect('`preceded whitespace `', isNot(accept(parser))); 103 | }); 104 | test('inlineComment', () { 105 | final parser = grammar.build(start: grammar.inlineComment).end(); 106 | expect('%inlineComment%', accept(parser)); 107 | expect('%inlineComment with whitespace%', accept(parser)); 108 | expect('%inlineComment with\nnewline%', accept(parser)); 109 | expect('%inlineComment with\n\nnewline%', isNot(accept(parser))); 110 | expect('%%', isNot(accept(parser))); 111 | expect('% succeded whitespace%', isNot(accept(parser))); 112 | expect('%preceded whitespace %', isNot(accept(parser))); 113 | }); 114 | }); 115 | 116 | group('link', () { 117 | test('url', () { 118 | final parser = grammar.build(start: grammar.url).end(); 119 | expect('{http://www.test.com}', accept(parser)); 120 | expect('{http://www\n.test.com}', accept(parser)); 121 | expect('{http://www\n\n.test.com}', isNot(accept(parser))); 122 | expect('{\nhttp://www.test.com}', isNot(accept(parser))); 123 | expect('{http://www.test.com\n}', isNot(accept(parser))); 124 | expect('{ tnueshotn utnuho}', accept(parser)); 125 | }); 126 | }); 127 | 128 | test('escaping', () { 129 | final parser = grammar.build(start: grammar.escaping).end(); 130 | expect('\\*', accept(parser)); 131 | expect('\\\n', accept(parser)); 132 | expect('\\\\', accept(parser)); 133 | }); 134 | 135 | group('paragraph segment', () { 136 | late Parser parser; 137 | setUp(() { 138 | parser = grammar.build(start: grammar.paragraphSegment).end(); 139 | }); 140 | test('attached modifiers', () { 141 | expect('test1 test2 test3 *bold* /italic/', accept(parser)); 142 | }); 143 | test('escaping', () { 144 | expect('\\*', accept(parser)); 145 | expect('\\*bold* test', accept(parser)); 146 | expect('\n', isNot(accept(parser))); 147 | expect('\n\n', isNot(accept(parser))); 148 | }); 149 | }); 150 | 151 | test('paragraph', () { 152 | final parser = grammar.build(start: grammar.paragraph).end(); 153 | expect('{test1}\ntest2 *test3*\ttest4', accept(parser)); 154 | expect('test', accept(parser)); 155 | expect('test\n', isNot(accept(parser))); 156 | }); 157 | 158 | test('document', () { 159 | final parser = grammar.build(start: grammar.document).end(); 160 | expect('{test1}\ntest2 *test3*\ttest4\n\n/italic/ bold _htun_\n\n', 161 | accept(parser)); 162 | expect('test', accept(parser)); 163 | expect(' test ', accept(parser)); 164 | expect('test\n', accept(parser)); 165 | }); 166 | 167 | test('norgWhitespace', () { 168 | final parser = grammar.build(start: grammar.norgWhitespace).end(); 169 | expect(' ', accept(parser)); 170 | expect(' ', accept(parser)); 171 | expect('\t', accept(parser)); 172 | expect(' \t ', accept(parser)); 173 | expect('\n', isNot(accept(parser))); 174 | }); 175 | 176 | test('plainText', () { 177 | final parser = grammar.build(start: grammar.plainText).end(); 178 | expect('test', accept(parser)); 179 | expect('\n', isNot(accept(parser))); 180 | expect('*', accept(parser)); 181 | expect('\\', accept(parser)); 182 | }); 183 | 184 | test('paragraphBreak', () { 185 | final parser = grammar.build(start: grammar.paragraphBreak).end(); 186 | expect('\n\n', accept(parser)); 187 | expect('\n\t \n', accept(parser)); 188 | expect('\n \n\t\n', accept(parser)); 189 | expect('\n\n\n ', isNot(accept(parser))); 190 | }); 191 | 192 | test('precedence', () { 193 | // TODO: improve 194 | final parser = grammar.build(start: grammar.paragraphSegment).end(); 195 | expect('{t*est} *', accept(parser)); 196 | }); 197 | }); 198 | }); 199 | } 200 | -------------------------------------------------------------------------------- /test/core/deserializer/petit/parser_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:groen/data/deserializer/petit/parser.dart'; 3 | import 'package:groen/data/model/model.dart'; 4 | import 'package:petitparser/debug.dart'; 5 | import 'package:petitparser/petitparser.dart'; 6 | 7 | bool Function(String) parsedAs( 8 | Parser parser, 9 | Node node, { 10 | bool tracing = false, 11 | }) { 12 | parser = tracing ? trace(parser) : parser; 13 | return (input) => parser.parse(input).value == node; 14 | } 15 | 16 | void expectParse(Parser parser, String parsee, dynamic matcher) => 17 | expect(parser.parse(parsee).value, matcher); 18 | 19 | void main() { 20 | group('NorgParser', () { 21 | late NorgParser np; 22 | setUp(() { 23 | np = const NorgParser(); 24 | }); 25 | group('parser', () { 26 | test('following leading whitespace', () { 27 | final parser = np.build(); 28 | expectParse( 29 | parser, 30 | 'test\n', 31 | const Document( 32 | start: 0, 33 | line: 1, 34 | column: 1, 35 | raw: 'test\n', 36 | children: [ 37 | Paragraph( 38 | start: 0, 39 | line: 1, 40 | column: 1, 41 | raw: 'test', 42 | children: [ 43 | ParagraphSegment( 44 | start: 0, 45 | line: 1, 46 | column: 1, 47 | raw: 'test', 48 | children: [ 49 | PlainText(start: 0, line: 1, column: 1, raw: 'test'), 50 | ], 51 | ) 52 | ], 53 | ), 54 | LineEnding(start: 4, line: 1, column: 5, raw: '\n'), 55 | ], 56 | ), 57 | ); 58 | }); 59 | }); 60 | test('document', () { 61 | final parser = np.build(); 62 | expectParse( 63 | parser, 64 | '*bold*\t{url} \\/nonitalic/\n\nnewpara', 65 | const Document( 66 | start: 0, 67 | line: 1, 68 | column: 1, 69 | raw: '*bold*\t{url} \\/nonitalic/\n\nnewpara', 70 | children: [ 71 | Paragraph( 72 | start: 0, 73 | line: 1, 74 | column: 1, 75 | raw: '*bold*\t{url} \\/nonitalic/', 76 | children: [ 77 | ParagraphSegment( 78 | start: 0, 79 | line: 1, 80 | column: 1, 81 | raw: '*bold*\t{url} \\/nonitalic/', 82 | children: [ 83 | AttachedModified( 84 | type: AttachedModType.bold, 85 | text: 'bold', 86 | start: 0, 87 | line: 1, 88 | column: 1, 89 | raw: '*bold*'), 90 | Whitespace(start: 6, line: 1, column: 7, raw: '\t'), 91 | Url( 92 | location: 'url', 93 | start: 7, 94 | line: 1, 95 | column: 8, 96 | raw: '{url}'), 97 | Whitespace(start: 12, line: 1, column: 13, raw: ' '), 98 | Escaping( 99 | escaped: '/', 100 | start: 13, 101 | line: 1, 102 | column: 14, 103 | raw: '\\/'), 104 | PlainText( 105 | start: 15, line: 1, column: 16, raw: 'nonitalic/'), 106 | ], 107 | ), 108 | ], 109 | ), 110 | ParagraphBreak(start: 25, line: 1, column: 26, raw: '\n\n'), 111 | Paragraph( 112 | start: 27, 113 | line: 3, 114 | column: 1, 115 | raw: "newpara", 116 | children: [ 117 | ParagraphSegment( 118 | start: 27, 119 | line: 3, 120 | column: 1, 121 | raw: "newpara", 122 | children: [ 123 | PlainText(start: 27, line: 3, column: 1, raw: 'newpara'), 124 | ], 125 | ), 126 | ], 127 | ), 128 | ], 129 | ), 130 | ); 131 | }); 132 | test('paragraph', () { 133 | final parser = np.build(start: np.paragraph).end(); 134 | expectParse( 135 | parser, 136 | '*bold*\t{url} \\/nonitalic/\nnewline', 137 | const Paragraph( 138 | start: 0, 139 | line: 1, 140 | column: 1, 141 | raw: '*bold*\t{url} \\/nonitalic/\nnewline', 142 | children: [ 143 | ParagraphSegment( 144 | start: 0, 145 | line: 1, 146 | column: 1, 147 | raw: '*bold*\t{url} \\/nonitalic/', 148 | children: [ 149 | AttachedModified( 150 | type: AttachedModType.bold, 151 | text: 'bold', 152 | start: 0, 153 | line: 1, 154 | column: 1, 155 | raw: '*bold*'), 156 | Whitespace(start: 6, line: 1, column: 7, raw: '\t'), 157 | Url( 158 | location: 'url', 159 | start: 7, 160 | line: 1, 161 | column: 8, 162 | raw: '{url}'), 163 | Whitespace(start: 12, line: 1, column: 13, raw: ' '), 164 | Escaping( 165 | escaped: '/', start: 13, line: 1, column: 14, raw: '\\/'), 166 | PlainText(start: 15, line: 1, column: 16, raw: 'nonitalic/'), 167 | ], 168 | ), 169 | LineEnding(start: 25, line: 1, column: 26, raw: '\n'), 170 | ParagraphSegment( 171 | start: 26, 172 | line: 2, 173 | column: 1, 174 | raw: "newline", 175 | children: [ 176 | PlainText(start: 26, line: 2, column: 1, raw: 'newline'), 177 | ], 178 | ) 179 | ], 180 | ), 181 | ); 182 | }); 183 | 184 | test('paragraph segment', () { 185 | final parser = np.build(start: np.paragraphSegment).end(); 186 | expectParse( 187 | parser, 188 | '*bold*\t{url} \\/nonitalic/', 189 | const ParagraphSegment( 190 | start: 0, 191 | line: 1, 192 | column: 1, 193 | raw: '*bold*\t{url} \\/nonitalic/', 194 | children: [ 195 | AttachedModified( 196 | type: AttachedModType.bold, 197 | text: 'bold', 198 | start: 0, 199 | line: 1, 200 | column: 1, 201 | raw: '*bold*'), 202 | Whitespace(start: 6, line: 1, column: 7, raw: '\t'), 203 | Url(location: 'url', start: 7, line: 1, column: 8, raw: '{url}'), 204 | Whitespace(start: 12, line: 1, column: 13, raw: ' '), 205 | Escaping(escaped: '/', start: 13, line: 1, column: 14, raw: '\\/'), 206 | PlainText(start: 15, line: 1, column: 16, raw: 'nonitalic/'), 207 | ], 208 | ), 209 | ); 210 | }); 211 | 212 | test('attached modifier', () { 213 | final parser = np.build(start: np.attachedModifiedElement).end(); 214 | expectParse( 215 | parser, 216 | '*bold*', 217 | const AttachedModified( 218 | type: AttachedModType.bold, 219 | text: 'bold', 220 | start: 0, 221 | line: 1, 222 | column: 1, 223 | raw: '*bold*', 224 | ), 225 | ); 226 | }); 227 | test('escaping', () { 228 | final parser = np.build(start: np.escaping).end(); 229 | expectParse( 230 | parser, 231 | '\\*', 232 | const Escaping( 233 | escaped: '*', 234 | start: 0, 235 | line: 1, 236 | column: 1, 237 | raw: '\\*', 238 | ), 239 | ); 240 | }); 241 | test('url', () { 242 | final parser = np.build(start: np.url).end(); 243 | expectParse( 244 | parser, 245 | '{link}', 246 | const Url( 247 | location: 'link', 248 | start: 0, 249 | line: 1, 250 | column: 1, 251 | raw: '{link}', 252 | ), 253 | ); 254 | }); 255 | test('norg whitespace', () { 256 | final parser = np.build(start: np.norgWhitespace).end(); 257 | expectParse( 258 | parser, 259 | ' \t ', 260 | const Whitespace( 261 | start: 0, 262 | line: 1, 263 | column: 1, 264 | raw: ' \t ', 265 | ), 266 | ); 267 | }); 268 | test('plain text', () { 269 | final parser = np.build(start: np.plainText).end(); 270 | expectParse( 271 | parser, 272 | 'test', 273 | const PlainText( 274 | start: 0, 275 | line: 1, 276 | column: 1, 277 | raw: 'test', 278 | ), 279 | ); 280 | }); 281 | }); 282 | } 283 | -------------------------------------------------------------------------------- /test/core/serializer/quill/node_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_quill/flutter_quill.dart' as quill; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:groen/data/model/model.dart'; 4 | import 'package:groen/data/serializer/quill/node.dart'; 5 | 6 | void main() { 7 | group('NodeDeltaSerializer tests', () { 8 | const document = Document( 9 | start: 1, 10 | raw: 'Hello *world*', 11 | line: 1, 12 | column: 1, 13 | children: [ 14 | Paragraph( 15 | start: 1, 16 | raw: 'Hello *world*', 17 | line: 1, 18 | column: 1, 19 | children: [ 20 | ParagraphSegment( 21 | start: 1, 22 | raw: 'Hello *world*', 23 | line: 1, 24 | column: 1, 25 | children: [ 26 | PlainText( 27 | raw: 'Hello', 28 | start: 1, 29 | line: 1, 30 | column: 1, 31 | ), 32 | Whitespace( 33 | raw: ' ', 34 | start: 1, 35 | line: 1, 36 | column: 1, 37 | ), 38 | AttachedModified( 39 | type: AttachedModType.bold, 40 | text: 'world', 41 | raw: '*world*', 42 | start: 1, 43 | line: 1, 44 | column: 1, 45 | ), 46 | ], 47 | ), 48 | ], 49 | ), 50 | ], 51 | ); 52 | 53 | test('DocumentDeltaSerializer', () { 54 | const serializer = DocumentDeltaSerializer(); 55 | final result = serializer.serializeNode(document); 56 | expect(result, isA()); 57 | expect(result.toJson(), [ 58 | {'insert': 'Hello '}, 59 | { 60 | 'insert': '*world*', 61 | 'attributes': {'bold': true}, 62 | }, 63 | ]); 64 | }); 65 | 66 | test('ParagraphDeltaSerializer', () { 67 | final paragraph = document.children!.first; 68 | const serializer = ParagraphDeltaSerializer(); 69 | final result = serializer.serializeNode(paragraph as Paragraph); 70 | expect(result, isA()); 71 | expect(result.toJson(), [ 72 | {'insert': 'Hello '}, 73 | { 74 | 'insert': '*world*', 75 | 'attributes': {'bold': true}, 76 | }, 77 | ]); 78 | }); 79 | 80 | test('ParagraphSegmentDeltaSerializer', () { 81 | final paragraph = document.children!.first; 82 | final segment = paragraph.children!.first as ParagraphSegment; 83 | const serializer = ParagraphSegmentDeltaSerializer(); 84 | final result = serializer.serializeNode(segment); 85 | expect(result, isA()); 86 | expect(result.toJson(), [ 87 | {'insert': 'Hello '}, 88 | { 89 | 'insert': '*world*', 90 | 'attributes': {'bold': true}, 91 | }, 92 | ]); 93 | }); 94 | 95 | test('UrlDeltaSerializer', () { 96 | const url = Url( 97 | raw: '{example.com}', 98 | start: 1, 99 | line: 1, 100 | column: 1, 101 | location: 'example.com', 102 | ); 103 | const serializer = UrlDeltaSerializer(); 104 | final result = serializer.serializeNode(url); 105 | expect(result, isA()); 106 | expect(result.toJson(), [ 107 | { 108 | 'insert': '{example.com}', 109 | 'attributes': {'link': 'example.com'} 110 | } 111 | ]); 112 | }); 113 | 114 | test('AttachedModDeltaSerializer', () { 115 | const bold = AttachedModified( 116 | type: AttachedModType.bold, 117 | text: 'world', 118 | raw: '*world*', 119 | start: 1, 120 | line: 1, 121 | column: 1, 122 | ); 123 | const serializer = AttachedModDeltaSerializer(); 124 | final result = serializer.serializeNode(bold); 125 | expect(result, isA()); 126 | expect(result.toJson(), [ 127 | { 128 | 'insert': '*world*', 129 | 'attributes': {'bold': true}, 130 | }, 131 | ]); 132 | }); 133 | }); 134 | } 135 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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 | groen 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "groen", 3 | "short_name": "groen", 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(groen 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 "groen") 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 | #include 12 | 13 | void RegisterPlugins(flutter::PluginRegistry* registry) { 14 | PasteboardPluginRegisterWithRegistrar( 15 | registry->GetRegistrarForPlugin("PasteboardPlugin")); 16 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 17 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 18 | UrlLauncherWindowsRegisterWithRegistrar( 19 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 20 | } 21 | -------------------------------------------------------------------------------- /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 | pasteboard 7 | permission_handler_windows 8 | url_launcher_windows 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /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 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /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 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 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.nacro90.groen" "\0" 93 | VALUE "FileDescription", "groen" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "groen" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.nacro90.groen. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "groen.exe" "\0" 98 | VALUE "ProductName", "groen" "\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"groen", 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/nacro90/Groen/5402dd0c36f99a500232410907ae683f17c554b5/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 | --------------------------------------------------------------------------------