├── .dockerignore ├── .gitignore ├── .metadata ├── .vscode └── launch.json ├── DEVELOPING.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── fluttermint │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ ├── android12splash.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-mdpi │ │ │ ├── android12splash.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-v21 │ │ │ ├── background.png │ │ │ └── launch_background.xml │ │ │ ├── drawable-xhdpi │ │ │ ├── android12splash.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-xxhdpi │ │ │ ├── android12splash.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-xxxhdpi │ │ │ ├── android12splash.png │ │ │ ├── ic_launcher_background.png │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable │ │ │ ├── background.png │ │ │ └── launch_background.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ └── ic_launcher.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-v31 │ │ │ └── styles.xml │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ ├── values-v31 │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── app │ ├── bg-dark.png │ ├── bolt-circle.png │ ├── dirtyqr.png │ ├── fed-graphic.png │ └── polygon.png ├── launcher │ ├── ic_background.png │ ├── ic_foreground.png │ └── icon.png ├── spinny_globe.riv └── splash │ ├── bg-dark.png │ └── image.png ├── fonts ├── AlbertSans-Regular.ttf ├── AlbertSans-SemiBold.ttf ├── Archivo-Black.ttf ├── Archivo-Bold.ttf ├── Archivo-ExtraBold.ttf ├── Archivo-ExtraLight.ttf ├── Archivo-Light.ttf ├── Archivo-Medium.ttf ├── Archivo-Regular.ttf ├── Archivo-SemiBold.ttf ├── Archivo-Thin.ttf ├── Archivo_Expanded-Black.ttf ├── Archivo_Expanded-Bold.ttf ├── Archivo_Expanded-ExtraBold.ttf ├── Archivo_Expanded-ExtraLight.ttf ├── Archivo_Expanded-Light.ttf ├── Archivo_Expanded-Medium.ttf ├── Archivo_Expanded-Regular.ttf ├── Archivo_Expanded-SemiBold.ttf ├── Archivo_Expanded-Thin.ttf └── Inter-Regular.ttf ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── 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-50x50@1x.png │ │ ├── Icon-App-50x50@2x.png │ │ ├── Icon-App-57x57@1x.png │ │ ├── Icon-App-57x57@2x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-72x72@1x.png │ │ ├── Icon-App-72x72@2x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ ├── LaunchBackground.imageset │ │ ├── Contents.json │ │ └── background.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 │ ├── Runner.entitlements │ └── bridge_generated.h ├── justfile ├── lib ├── bridge_generated.dart ├── data │ ├── balance.dart │ ├── receive.dart │ ├── send.dart │ └── transactions.dart ├── ffi.dart ├── generated_plugin_registrant.dart ├── main.dart ├── router.dart ├── screens │ ├── about.dart │ ├── error_page.dart │ ├── home.dart │ ├── receive.dart │ ├── receive_confirm.dart │ ├── send.dart │ ├── send_confirm.dart │ ├── send_finish.dart │ ├── setup.dart │ └── setup_join.dart ├── utils │ ├── constants.dart │ ├── network_detector_notifier.dart │ └── unimplemented.dart └── widgets │ ├── autopaste_text_field.dart │ ├── balance_display.dart │ ├── button.dart │ ├── chill_info_card.dart │ ├── content_padding.dart │ ├── data_expander.dart │ ├── ellipsable_text.dart │ ├── fedi_appbar.dart │ ├── fedi_tooltip.dart │ ├── logo_action.dart │ ├── not_connected_warning.dart │ ├── outline_gradient.dart │ ├── qr_display.dart │ ├── reassemble_listener.dart │ ├── scroll_if_u_want.dart │ ├── single_tx.dart │ ├── textured.dart │ ├── toggle.dart │ └── transaction_list.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 ├── Podfile.lock ├── 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 │ └── bridge_generated.h ├── minimint-bridge ├── .cargo │ ├── ar.aarch64-linux-android │ ├── ar.armv7-linux-androideabi │ ├── ar.i686-linux-android │ ├── ar.x86_64-linux-android │ ├── config.toml │ ├── ld.aarch64-linux-android │ ├── ld.armv7-linux-androideabi │ ├── ld.i686-linux-android │ └── ld.x86_64-linux-android ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── flake.lock ├── flake.nix ├── minimint-bridge.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ ├── futurepaul.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── justin.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── src │ ├── api.rs │ ├── bridge_generated.rs │ ├── client.rs │ ├── lib.rs │ └── payments.rs ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart └── 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 /.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | /build 3 | -------------------------------------------------------------------------------- /.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 | 46 | # NDK build artifacts 47 | 48 | android/app/src/main/jniLibs/* 49 | 50 | /minimint-bridge/.direnv 51 | -------------------------------------------------------------------------------- /.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: 0a5a641f8f0f43a091c396bca89473ff56707ce0 8 | channel: master 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 17 | base_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 18 | - platform: android 19 | create_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 20 | base_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 21 | - platform: ios 22 | create_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 23 | base_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 24 | - platform: linux 25 | create_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 26 | base_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 27 | - platform: macos 28 | create_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 29 | base_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 30 | - platform: web 31 | create_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 32 | base_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 33 | - platform: windows 34 | create_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 35 | base_revision: 0a5a641f8f0f43a091c396bca89473ff56707ce0 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "fluttermint", 9 | "request": "launch", 10 | "type": "dart" 11 | }, 12 | { 13 | "name": "fluttermint (profile mode)", 14 | "request": "launch", 15 | "type": "dart", 16 | "flutterMode": "profile" 17 | }, 18 | { 19 | "name": "fluttermint (release mode)", 20 | "request": "launch", 21 | "type": "dart", 22 | "flutterMode": "release" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /DEVELOPING.md: -------------------------------------------------------------------------------- 1 | # Developing 2 | 3 | `just gen` generates the language bindings 4 | 5 | If you're following the flutter_rust_bridge guide, you'll want ["Alternative NDK setup"](http://cjycode.com/flutter_rust_bridge/template/setup_android.html?highlight=ndk#alternative-ndk-setup) and compile with rust nightly for now. 6 | 7 | ## Android 8 | 9 | Justin did this somewhere along the way. Not sure if necessary. 10 | 11 | ``` 12 | $ cat ~/.gradle/gradle.properties 13 | ANDROID_NDK=/Users/justin/Library/Android/sdk/ndk-bundle 14 | ``` 15 | 16 | Tail logs from terminal: 17 | 18 | ``` 19 | adb logcat | grep -F "`adb shell ps | grep com.justinmoon.fluttermint | tr -s [:space:] ' ' | cut -d' ' -f2`" 20 | ``` 21 | 22 | # Releases 23 | 24 | When making a release, increment version number and build number in pubspec.yaml. 25 | 26 | ## Testflight 27 | 28 | Build the IPA: 29 | 30 | ``` 31 | flutter build ipa 32 | ``` 33 | 34 | Uploaded it using transport app. 35 | 36 | ## Play Store 37 | 38 | 39 | ``` 40 | flutter build appbundle 41 | ``` 42 | 43 | Upload that to Google Play. [Here](https://docs.flutter.dev/deployment/android#offline-using-the-bundle-tool) are some docs about testing it locally. 44 | 45 | # Contributing 46 | 47 | Contributions are very welcome, just open an issue or PR if you see something to improve! 48 | 49 | Please note that all contributions happen under the MIT license as described below: 50 | 51 | ``` 52 | Developer Certificate of Origin 53 | Version 1.1 54 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 55 | Everyone is permitted to copy and distribute verbatim copies of this 56 | license document, but changing it is not allowed. 57 | Developer's Certificate of Origin 1.1 58 | By making a contribution to this project, I certify that: 59 | (a) The contribution was created in whole or in part by me and I 60 | have the right to submit it under the open source license 61 | indicated in the file; or 62 | (b) The contribution is based upon previous work that, to the best 63 | of my knowledge, is covered under an appropriate open source 64 | license and I have the right under that license to submit that 65 | work with modifications, whether created in whole or in part 66 | by me, under the same open source license (unless I am 67 | permitted to submit under a different license), as indicated 68 | in the file; or 69 | (c) The contribution was provided directly to me by some other 70 | person who certified (a), (b) or (c) and I have not modified 71 | it. 72 | (d) I understand and agree that this project and the contribution 73 | are public and that a record of the contribution (including all 74 | personal information I submit with it, including my sign-off) is 75 | maintained indefinitely and may be redistributed consistent with 76 | this project or the open source license(s) involved. 77 | ``` -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Paul Miller and Justin Moon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fluttermint 2 | 3 | A Fedimint wallet in Flutter + Rust. DO NOT USE WITH (serious amounts of) REAL MONEY! This is for tinkering, only. 4 | 5 | ![Frame 67 (2)](https://user-images.githubusercontent.com/543668/172901667-df3eb020-db13-40b1-8aa5-8041a9782e5a.png) 6 | 7 | To try Fluttermint, [download Android APK](https://github.com/futurepaul/fluttermint/releases) or [join iOS Testflight](https://testflight.apple.com/join/Coep5PZS). Use [this signet faucet](https://faucet.sirion.io/) to play with the app with fake bitcoin. 8 | 9 | See [DEVELOPING.md](./DEVELOPING.md) for notes about contributing to Fluttermint. 10 | -------------------------------------------------------------------------------- /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 | // For Play Store uploads https://docs.flutter.dev/deployment/android#configure-signing-in-gradle 2 | def keystoreProperties = new Properties() 3 | def keystorePropertiesFile = rootProject.file('key.properties') 4 | if (keystorePropertiesFile.exists()) { 5 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 6 | } 7 | 8 | def localProperties = new Properties() 9 | def localPropertiesFile = rootProject.file('local.properties') 10 | if (localPropertiesFile.exists()) { 11 | localPropertiesFile.withReader('UTF-8') { reader -> 12 | localProperties.load(reader) 13 | } 14 | } 15 | 16 | def flutterRoot = localProperties.getProperty('flutter.sdk') 17 | if (flutterRoot == null) { 18 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 19 | } 20 | 21 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 22 | if (flutterVersionCode == null) { 23 | flutterVersionCode = '1' 24 | } 25 | 26 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 27 | if (flutterVersionName == null) { 28 | flutterVersionName = '1.0' 29 | } 30 | 31 | apply plugin: 'com.android.application' 32 | apply plugin: 'kotlin-android' 33 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 34 | 35 | android { 36 | // mobile_scaner only works with v32 37 | compileSdkVersion 32 38 | ndkVersion flutter.ndkVersion 39 | 40 | compileOptions { 41 | sourceCompatibility JavaVersion.VERSION_1_8 42 | targetCompatibility JavaVersion.VERSION_1_8 43 | } 44 | 45 | kotlinOptions { 46 | jvmTarget = '1.8' 47 | } 48 | 49 | sourceSets { 50 | main.java.srcDirs += 'src/main/kotlin' 51 | } 52 | 53 | defaultConfig { 54 | applicationId "com.justinmoon.fluttermint" 55 | // mobile_scanner only works with v21 56 | minSdkVersion 21 57 | targetSdkVersion flutter.targetSdkVersion 58 | versionCode flutterVersionCode.toInteger() 59 | versionName flutterVersionName 60 | } 61 | 62 | signingConfigs { 63 | release { 64 | keyAlias keystoreProperties['keyAlias'] 65 | keyPassword keystoreProperties['keyPassword'] 66 | storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 67 | storePassword keystoreProperties['storePassword'] 68 | } 69 | } 70 | 71 | buildTypes { 72 | release { 73 | signingConfig signingConfigs.release 74 | } 75 | } 76 | } 77 | 78 | flutter { 79 | source '../..' 80 | } 81 | 82 | dependencies { 83 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 84 | } 85 | 86 | // http://cjycode.com/flutter_rust_bridge/integrate/android_tasks.html?highlight=Tuple2#hooking-onto-tasks 87 | [ 88 | new Tuple2('Debug', ''), 89 | new Tuple2('Profile', '--release'), 90 | new Tuple2('Release', '--release') 91 | ].each { 92 | def taskPostfix = it.first 93 | def profileMode = it.second 94 | tasks.whenTaskAdded { task -> 95 | if (task.name == "javaPreCompile$taskPostfix") { 96 | task.dependsOn "cargoBuild$taskPostfix" 97 | } 98 | } 99 | tasks.register("cargoBuild$taskPostfix", Exec) { 100 | // Without this, android was looking in the wrong place for clang to build secp256k1-zkp 101 | commandLine 'sh', '-c', """cd ../../minimint-bridge && \ 102 | ANDROID_NDK_HOME="$ANDROID_NDK" cargo ndk \ 103 | -t armeabi-v7a -t arm64-v8a -t x86 -t x86_64 \ 104 | -o ../android/app/src/main/jniLibs build $profileMode""" 105 | } 106 | } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 17 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/fluttermint/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.justinmoon.fluttermint 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/android12splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-hdpi/android12splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-hdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/android12splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-mdpi/android12splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-mdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-v21/background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/android12splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xhdpi/android12splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/android12splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xxhdpi/android12splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/android12splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xxxhdpi/android12splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/drawable/background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night-v31/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-v31/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 18 | 21 | 22 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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 | # https://docs.flutter.dev/deployment/android#building-the-app-for-release 5 | android.bundle.enableUncompressedNativeLibs=false 6 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | # https://pub.dev/packages/qr_code_scanner#android-integration 7 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/app/bg-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/app/bg-dark.png -------------------------------------------------------------------------------- /assets/app/bolt-circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/app/bolt-circle.png -------------------------------------------------------------------------------- /assets/app/dirtyqr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/app/dirtyqr.png -------------------------------------------------------------------------------- /assets/app/fed-graphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/app/fed-graphic.png -------------------------------------------------------------------------------- /assets/app/polygon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/app/polygon.png -------------------------------------------------------------------------------- /assets/launcher/ic_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/launcher/ic_background.png -------------------------------------------------------------------------------- /assets/launcher/ic_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/launcher/ic_foreground.png -------------------------------------------------------------------------------- /assets/launcher/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/launcher/icon.png -------------------------------------------------------------------------------- /assets/spinny_globe.riv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/spinny_globe.riv -------------------------------------------------------------------------------- /assets/splash/bg-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/splash/bg-dark.png -------------------------------------------------------------------------------- /assets/splash/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/assets/splash/image.png -------------------------------------------------------------------------------- /fonts/AlbertSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/AlbertSans-Regular.ttf -------------------------------------------------------------------------------- /fonts/AlbertSans-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/AlbertSans-SemiBold.ttf -------------------------------------------------------------------------------- /fonts/Archivo-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-Black.ttf -------------------------------------------------------------------------------- /fonts/Archivo-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-Bold.ttf -------------------------------------------------------------------------------- /fonts/Archivo-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-ExtraBold.ttf -------------------------------------------------------------------------------- /fonts/Archivo-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-ExtraLight.ttf -------------------------------------------------------------------------------- /fonts/Archivo-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-Light.ttf -------------------------------------------------------------------------------- /fonts/Archivo-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-Medium.ttf -------------------------------------------------------------------------------- /fonts/Archivo-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-Regular.ttf -------------------------------------------------------------------------------- /fonts/Archivo-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-SemiBold.ttf -------------------------------------------------------------------------------- /fonts/Archivo-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo-Thin.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-Black.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-Bold.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-ExtraBold.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-ExtraLight.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-Light.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-Medium.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-Regular.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-SemiBold.ttf -------------------------------------------------------------------------------- /fonts/Archivo_Expanded-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Archivo_Expanded-Thin.ttf -------------------------------------------------------------------------------- /fonts/Inter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/fonts/Inter-Regular.ttf -------------------------------------------------------------------------------- /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/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, '12.3' 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.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 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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 | 5 | @UIApplicationMain 6 | @objc class AppDelegate: FlutterAppDelegate { 7 | override func application( 8 | _ application: UIApplication, 9 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 10 | ) -> Bool { 11 | // http://cjycode.com/flutter_rust_bridge/integrate/ios_headers.html 12 | let dummy = dummy_method_to_enforce_bundling() 13 | print(dummy) 14 | GeneratedPluginRegistrant.register(with: self) 15 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "background.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "LaunchImage.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "filename" : "LaunchImage@2x.png", 10 | "idiom" : "universal", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "filename" : "LaunchImage@3x.png", 15 | "idiom" : "universal", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "author" : "xcode", 21 | "version" : 1 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /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 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | Fluttermint 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | fluttermint 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $(FLUTTER_BUILD_NUMBER) 27 | ITSAppUsesNonExemptEncryption 28 | 29 | LSRequiresIPhoneOS 30 | 31 | NSAppTransportSecurity 32 | 33 | NSAllowsArbitraryLoads 34 | 35 | 36 | NSBonjourServices 37 | 38 | _dartobservatory._tcp 39 | 40 | NSCameraUsageDescription 41 | Scan QR codes for setup and payments. 42 | UIApplicationSupportsIndirectInputEvents 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIMainStoryboardFile 47 | Main 48 | UIStatusBarHidden 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | 61 | UIViewControllerBasedStatusBarAppearance 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "bridge_generated.h" 2 | #import "GeneratedPluginRegistrant.h" 3 | -------------------------------------------------------------------------------- /ios/Runner/Runner.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ios/Runner/bridge_generated.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | typedef struct wire_uint_8_list { 6 | uint8_t *ptr; 7 | int32_t len; 8 | } wire_uint_8_list; 9 | 10 | typedef struct wire_BridgeGuardianInfo { 11 | struct wire_uint_8_list *name; 12 | struct wire_uint_8_list *address; 13 | bool online; 14 | } wire_BridgeGuardianInfo; 15 | 16 | typedef struct wire_list_bridge_guardian_info { 17 | struct wire_BridgeGuardianInfo *ptr; 18 | int32_t len; 19 | } wire_list_bridge_guardian_info; 20 | 21 | typedef struct wire_BridgeFederationInfo { 22 | struct wire_uint_8_list *name; 23 | struct wire_uint_8_list *network; 24 | bool current; 25 | struct wire_list_bridge_guardian_info *guardians; 26 | } wire_BridgeFederationInfo; 27 | 28 | typedef struct WireSyncReturnStruct { 29 | uint8_t *ptr; 30 | int32_t len; 31 | bool success; 32 | } WireSyncReturnStruct; 33 | 34 | typedef int64_t DartPort; 35 | 36 | typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message); 37 | 38 | void wire_init(int64_t port_, struct wire_uint_8_list *path); 39 | 40 | void wire_join_federation(int64_t port_, struct wire_uint_8_list *config_url); 41 | 42 | void wire_leave_federation(int64_t port_); 43 | 44 | void wire_balance(int64_t port_); 45 | 46 | void wire_pay(int64_t port_, struct wire_uint_8_list *bolt11); 47 | 48 | void wire_invoice(int64_t port_, uint64_t amount, struct wire_uint_8_list *description); 49 | 50 | void wire_fetch_payment(int64_t port_, struct wire_uint_8_list *payment_hash); 51 | 52 | void wire_list_payments(int64_t port_); 53 | 54 | void wire_configured_status(int64_t port_); 55 | 56 | void wire_connection_status(int64_t port_); 57 | 58 | void wire_network(int64_t port_); 59 | 60 | void wire_calculate_fee(int64_t port_, struct wire_uint_8_list *bolt11); 61 | 62 | void wire_list_federations(int64_t port_); 63 | 64 | void wire_switch_federation(int64_t port_, struct wire_BridgeFederationInfo *_federation); 65 | 66 | void wire_decode_invoice(int64_t port_, struct wire_uint_8_list *bolt11); 67 | 68 | struct wire_BridgeFederationInfo *new_box_autoadd_bridge_federation_info_0(void); 69 | 70 | struct wire_list_bridge_guardian_info *new_list_bridge_guardian_info_0(int32_t len); 71 | 72 | struct wire_uint_8_list *new_uint_8_list_0(int32_t len); 73 | 74 | void free_WireSyncReturnStruct(struct WireSyncReturnStruct val); 75 | 76 | void store_dart_post_cobject(DartPostCObjectFnType ptr); 77 | 78 | static int64_t dummy_method_to_enforce_bundling(void) { 79 | int64_t dummy_var = 0; 80 | dummy_var ^= ((int64_t) (void*) wire_init); 81 | dummy_var ^= ((int64_t) (void*) wire_join_federation); 82 | dummy_var ^= ((int64_t) (void*) wire_leave_federation); 83 | dummy_var ^= ((int64_t) (void*) wire_balance); 84 | dummy_var ^= ((int64_t) (void*) wire_pay); 85 | dummy_var ^= ((int64_t) (void*) wire_invoice); 86 | dummy_var ^= ((int64_t) (void*) wire_fetch_payment); 87 | dummy_var ^= ((int64_t) (void*) wire_list_payments); 88 | dummy_var ^= ((int64_t) (void*) wire_configured_status); 89 | dummy_var ^= ((int64_t) (void*) wire_connection_status); 90 | dummy_var ^= ((int64_t) (void*) wire_network); 91 | dummy_var ^= ((int64_t) (void*) wire_calculate_fee); 92 | dummy_var ^= ((int64_t) (void*) wire_list_federations); 93 | dummy_var ^= ((int64_t) (void*) wire_switch_federation); 94 | dummy_var ^= ((int64_t) (void*) wire_decode_invoice); 95 | dummy_var ^= ((int64_t) (void*) new_box_autoadd_bridge_federation_info_0); 96 | dummy_var ^= ((int64_t) (void*) new_list_bridge_guardian_info_0); 97 | dummy_var ^= ((int64_t) (void*) new_uint_8_list_0); 98 | dummy_var ^= ((int64_t) (void*) free_WireSyncReturnStruct); 99 | dummy_var ^= ((int64_t) (void*) store_dart_post_cobject); 100 | return dummy_var; 101 | } -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | default: gen 2 | 3 | gen: 4 | flutter_rust_bridge_codegen \ 5 | -r minimint-bridge/src/api.rs \ 6 | -d lib/bridge_generated.dart \ 7 | -c ios/Runner/bridge_generated.h \ 8 | -c macos/Runner/bridge_generated.h 9 | 10 | -------------------------------------------------------------------------------- /lib/data/balance.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:intl/intl.dart'; 3 | import 'package:riverpod/riverpod.dart'; 4 | 5 | import '../ffi.dart'; 6 | 7 | enum Denom { sats, btc } 8 | 9 | extension ParseToString on Denom { 10 | String toReadableString() { 11 | switch (this) { 12 | case Denom.sats: 13 | return "SATS"; 14 | case Denom.btc: 15 | return "BTC"; 16 | } 17 | } 18 | } 19 | 20 | @immutable 21 | class Balance { 22 | const Balance({required this.amountSats, this.denomination = Denom.sats}); 23 | 24 | final int amountSats; 25 | final Denom denomination; 26 | 27 | //TODO: this could be a lot better 28 | String prettyPrint() { 29 | switch (denomination) { 30 | case Denom.sats: 31 | return NumberFormat.decimalPattern().format(amountSats); 32 | case Denom.btc: 33 | return (amountSats / 100000000).toStringAsFixed(8); 34 | } 35 | } 36 | 37 | // Since Receive is immutable, we implement a method that allows cloning the 38 | // Receive with slightly different content. 39 | Balance copyWith({int? amountSats, Denom? denomination}) { 40 | return Balance( 41 | amountSats: amountSats ?? this.amountSats, 42 | denomination: denomination ?? this.denomination, 43 | ); 44 | } 45 | } 46 | 47 | class BalanceNotifier extends StateNotifier { 48 | BalanceNotifier() : super(null); 49 | 50 | refreshBalance() async { 51 | try { 52 | final int balance = await api.balance(); 53 | state = 54 | state?.copyWith(amountSats: balance) ?? Balance(amountSats: balance); 55 | } catch (e) { 56 | debugPrint('Caught error in refreshBalance: $e'); 57 | state = null; 58 | } 59 | } 60 | 61 | switchDenom() async { 62 | debugPrint("switching denom"); 63 | debugPrint("existing: ${state?.denomination.toString()}"); 64 | var denom = state?.denomination; 65 | if (denom == Denom.sats) { 66 | denom = Denom.btc; 67 | } else { 68 | denom = Denom.sats; 69 | } 70 | debugPrint("new: $denom"); 71 | 72 | state = state?.copyWith(denomination: denom); 73 | } 74 | 75 | clear() { 76 | state = null; 77 | } 78 | } 79 | 80 | final balanceProvider = StateNotifierProvider((ref) { 81 | return BalanceNotifier(); 82 | }); 83 | -------------------------------------------------------------------------------- /lib/data/receive.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:riverpod/riverpod.dart'; 3 | 4 | import '../ffi.dart'; 5 | 6 | @immutable 7 | class Receive { 8 | const Receive( 9 | {required this.description, 10 | required this.amountSats, 11 | this.invoice, 12 | this.receiveStatus}); 13 | 14 | final String description; 15 | final int amountSats; 16 | final String? invoice; 17 | final String? receiveStatus; 18 | 19 | // Since Receive is immutable, we implement a method that allows cloning the 20 | // Receive with slightly different content. 21 | Receive copyWith( 22 | {String? description, 23 | int? amountSats, 24 | String? invoice, 25 | String? receiveStatus}) { 26 | return Receive( 27 | description: description ?? this.description, 28 | amountSats: amountSats ?? this.amountSats, 29 | invoice: invoice ?? this.invoice, 30 | receiveStatus: receiveStatus ?? this.receiveStatus); 31 | } 32 | } 33 | 34 | class ReceiveNotifier extends StateNotifier { 35 | ReceiveNotifier() : super(null); 36 | 37 | createReceive(Receive receive) async { 38 | state = receive.copyWith( 39 | invoice: await api.invoice( 40 | amount: receive.amountSats, description: receive.description)); 41 | } 42 | 43 | checkPaymentStatus() async { 44 | try { 45 | final invoice = state?.invoice; 46 | if (invoice == null) { 47 | throw Exception("no error for some reason"); 48 | } 49 | debugPrint("checking status for $invoice"); 50 | 51 | var decoded = await api.decodeInvoice(bolt11: invoice); 52 | var status = await api.fetchPayment(paymentHash: decoded.paymentHash); 53 | debugPrint(status.paid ? "paid" : "not paid"); 54 | if (status.paid) { 55 | state = state?.copyWith(receiveStatus: "paid"); 56 | } else { 57 | state = state?.copyWith(receiveStatus: "pending"); 58 | } 59 | 60 | // state = state?.copyWith(sendStatus: response.status); 61 | } catch (e) { 62 | debugPrint('Caught error: $e'); 63 | throw Exception(e.toString()); 64 | } 65 | } 66 | 67 | clear() { 68 | state = null; 69 | } 70 | } 71 | 72 | final receiveProvider = StateNotifierProvider((ref) { 73 | return ReceiveNotifier(); 74 | }); 75 | -------------------------------------------------------------------------------- /lib/data/send.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:riverpod/riverpod.dart'; 3 | 4 | import '../ffi.dart'; 5 | 6 | @immutable 7 | class Send { 8 | const Send( 9 | {required this.description, 10 | required this.amountSats, 11 | required this.invoice, 12 | this.fee}); 13 | 14 | final String description; 15 | final int amountSats; 16 | final String invoice; 17 | final int? fee; 18 | 19 | // Since Receive is immutable, we implement a method that allows cloning the 20 | // Receive with slightly different content. 21 | Send copyWith( 22 | {String? description, int? amountSats, String? invoice, int? fee}) { 23 | return Send( 24 | description: description ?? this.description, 25 | amountSats: amountSats ?? this.amountSats, 26 | invoice: invoice ?? this.invoice, 27 | fee: fee ?? this.fee, 28 | ); 29 | } 30 | } 31 | 32 | class SendNotifier extends StateNotifier { 33 | SendNotifier() : super(null); 34 | 35 | createSend(Send send) async { 36 | final fee = await api.calculateFee(bolt11: send.invoice); 37 | state = send.copyWith(invoice: send.invoice, fee: fee ?? 0); 38 | } 39 | 40 | pay(Send send) async { 41 | await api.pay(bolt11: send.invoice); 42 | state = null; 43 | } 44 | 45 | clear() { 46 | state = null; 47 | } 48 | } 49 | 50 | final sendProvider = StateNotifierProvider((ref) { 51 | return SendNotifier(); 52 | }); 53 | -------------------------------------------------------------------------------- /lib/data/transactions.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:intl/intl.dart'; 3 | import 'package:riverpod/riverpod.dart'; 4 | 5 | import 'package:fluttermint/bridge_generated.dart'; 6 | import 'package:fluttermint/ffi.dart'; 7 | 8 | extension ParseToString on PaymentStatus { 9 | String toReadableString() { 10 | switch (this) { 11 | case PaymentStatus.Expired: 12 | return "Expired"; 13 | case PaymentStatus.Paid: 14 | return "Paid"; 15 | case PaymentStatus.Pending: 16 | return "Pending"; 17 | case PaymentStatus.Failed: 18 | return "Failed"; 19 | } 20 | } 21 | } 22 | 23 | Transaction txFromBridgePayment(BridgePayment payment) { 24 | final when = DateTime.fromMillisecondsSinceEpoch(payment.createdAt * 1000); 25 | 26 | return Transaction( 27 | description: payment.invoice.description, 28 | amountSats: payment.invoice.amount, 29 | invoice: payment.invoice.invoice, 30 | when: DateFormat.MMMMd().add_jm().format(when), 31 | status: payment.status.toReadableString(), 32 | direction: payment.direction); 33 | } 34 | 35 | @immutable 36 | class Transaction { 37 | const Transaction( 38 | {required this.description, 39 | required this.amountSats, 40 | required this.invoice, 41 | required this.when, 42 | required this.status, 43 | required this.direction}); 44 | 45 | final String description; 46 | final int amountSats; 47 | final String invoice; 48 | final String when; 49 | final String status; 50 | final PaymentDirection direction; 51 | } 52 | 53 | @immutable 54 | class Transactions { 55 | const Transactions([this.txs = const []]); 56 | 57 | final List txs; 58 | 59 | Transactions append(Transaction tx) { 60 | return Transactions([...txs, tx]); 61 | } 62 | } 63 | 64 | class TransactionsNotifier extends StateNotifier { 65 | TransactionsNotifier() : super(const Transactions()); 66 | 67 | addTransaction(Transaction tx) async { 68 | state = state.append(tx); 69 | } 70 | 71 | fetchTransactions() async { 72 | debugPrint("Fetching txs"); 73 | var payments = await api.listPayments(); 74 | payments.sort((a, b) => b.createdAt.compareTo(a.createdAt)); 75 | List txs = []; 76 | for (var payment in payments) { 77 | txs.add(txFromBridgePayment(payment)); 78 | } 79 | state = Transactions(txs); 80 | } 81 | 82 | clear() { 83 | state = [] as Transactions; 84 | } 85 | } 86 | 87 | final transactionsProvider = 88 | StateNotifierProvider((ref) { 89 | return TransactionsNotifier(); 90 | }); 91 | -------------------------------------------------------------------------------- /lib/ffi.dart: -------------------------------------------------------------------------------- 1 | // This file initializes the dynamic library and connects it with the stub 2 | // generated by flutter_rust_bridge_codegen. 3 | 4 | import 'dart:ffi'; 5 | 6 | import 'package:path_provider/path_provider.dart'; 7 | 8 | import 'ffi.dart'; 9 | export 'bridge_generated.dart'; 10 | import 'dart:io' as io; 11 | 12 | const _base = 'minimint_bridge'; 13 | 14 | // On MacOS, the dynamic library is not bundled with the binary, 15 | // but rather directly **linked** against the binary. 16 | final _dylib = io.Platform.isWindows ? '$_base.dll' : 'lib$_base.so'; 17 | 18 | // The late modifier delays initializing the value until it is actually needed, 19 | // leaving precious little time for the program to quickly start up. 20 | late final MinimintBridge api = MinimintBridgeImpl( 21 | io.Platform.isIOS || io.Platform.isMacOS 22 | ? DynamicLibrary.executable() 23 | : DynamicLibrary.open(_dylib)); 24 | -------------------------------------------------------------------------------- /lib/generated_plugin_registrant.dart: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // ignore_for_file: directives_ordering 6 | // ignore_for_file: lines_longer_than_80_chars 7 | // ignore_for_file: depend_on_referenced_packages 8 | 9 | import 'package:connectivity_for_web/connectivity_for_web.dart'; 10 | import 'package:flutter_native_splash/flutter_native_splash_web.dart'; 11 | import 'package:share_plus_web/share_plus_web.dart'; 12 | import 'package:url_launcher_web/url_launcher_web.dart'; 13 | 14 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; 15 | 16 | // ignore: public_member_api_docs 17 | void registerPlugins(Registrar registrar) { 18 | ConnectivityPlugin.registerWith(registrar); 19 | FlutterNativeSplashWeb.registerWith(registrar); 20 | SharePlusPlugin.registerWith(registrar); 21 | UrlLauncherPlugin.registerWith(registrar); 22 | registrar.registerMessageHandler(); 23 | } 24 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:fluttermint/router.dart'; 5 | import 'package:fluttermint/utils/constants.dart'; 6 | import 'package:path_provider/path_provider.dart'; 7 | import './ffi.dart'; 8 | 9 | Future main() async { 10 | WidgetsFlutterBinding.ensureInitialized(); 11 | 12 | try { 13 | final userDir = (await getApplicationDocumentsDirectory()).path; 14 | final success = await api.init(path: userDir); 15 | debugPrint("init was = $success"); 16 | } catch (e) { 17 | debugPrint('Caught error in init: $e'); 18 | } 19 | 20 | runApp(const ProviderScope(child: App())); 21 | } 22 | 23 | class App extends ConsumerWidget { 24 | const App({Key? key}) : super(key: key); 25 | 26 | static const title = 'Fluttermint'; 27 | 28 | // This widget is the root of your application. 29 | @override 30 | Widget build(BuildContext context, WidgetRef ref) { 31 | final router = ref.watch(routerProvider); 32 | 33 | SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( 34 | statusBarColor: Colors.transparent, 35 | // IOS 36 | statusBarBrightness: Brightness.dark, 37 | // Android, opposite meaning lol 38 | statusBarIconBrightness: Brightness.light, 39 | )); 40 | 41 | return MaterialApp.router( 42 | routeInformationParser: router.routeInformationParser, 43 | routeInformationProvider: router.routeInformationProvider, 44 | routerDelegate: router.routerDelegate, 45 | title: title, 46 | debugShowCheckedModeBanner: false, 47 | theme: ThemeData( 48 | brightness: Brightness.dark, 49 | primaryColor: white, 50 | primarySwatch: materialWhite, 51 | textTheme: textThemeDefault, 52 | backgroundColor: white, 53 | scaffoldBackgroundColor: black, 54 | fontFamily: "Albert Sans"), 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/screens/about.dart: -------------------------------------------------------------------------------- 1 | import 'package:fluttermint/screens/home.dart'; 2 | import 'package:fluttermint/utils/constants.dart'; 3 | import 'package:hooks_riverpod/hooks_riverpod.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:go_router/go_router.dart'; 6 | 7 | import 'package:fluttermint/widgets/content_padding.dart'; 8 | import 'package:fluttermint/widgets/fedi_appbar.dart'; 9 | import 'package:fluttermint/widgets/textured.dart'; 10 | import 'package:package_info_plus/package_info_plus.dart'; 11 | import 'package:url_launcher/url_launcher.dart'; 12 | 13 | final isCreatingReceive = StateProvider((ref) => false); 14 | 15 | const repo = 'https://github.com/futurepaul/fluttermint'; 16 | const faucet = 'https://faucet.sirion.io/'; 17 | 18 | final packageInfoProvider = FutureProvider((_) async { 19 | return await PackageInfo.fromPlatform(); 20 | }); 21 | 22 | class AboutScreen extends HookConsumerWidget { 23 | const AboutScreen({Key? key}) : super(key: key); 24 | 25 | @override 26 | Widget build(BuildContext context, WidgetRef ref) { 27 | final packageInfoOnce = ref.watch(packageInfoProvider); 28 | final bitcionNetwork = ref.watch(bitcoinNetworkProvider); 29 | return Textured( 30 | child: Scaffold( 31 | backgroundColor: Colors.transparent, 32 | appBar: FediAppBar( 33 | title: "About", 34 | closeAction: () { 35 | context.go("/"); 36 | }, 37 | ), 38 | body: ContentPadding( 39 | child: Column( 40 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 41 | children: [ 42 | Column( 43 | crossAxisAlignment: CrossAxisAlignment.start, 44 | children: [ 45 | Text("NETWORK", style: Theme.of(context).textTheme.headline6), 46 | spacer6, 47 | bitcionNetwork.when( 48 | data: (data) => Text(data), 49 | error: (err, stacktrace) => Text(err.toString()), 50 | loading: () => spacer0), 51 | spacer24, 52 | Text("VERSION", style: Theme.of(context).textTheme.headline6), 53 | spacer6, 54 | packageInfoOnce.when( 55 | data: (data) => 56 | Text("${data.version} + ${data.buildNumber}"), 57 | error: (err, stacktrace) => Text(err.toString()), 58 | loading: () => spacer0), 59 | spacer24, 60 | Text("CONTRIBUTE", 61 | style: Theme.of(context).textTheme.headline6), 62 | spacer6, 63 | GestureDetector( 64 | onTap: () async { 65 | final Uri url = Uri.parse(repo); 66 | if (!await launchUrl(url)) { 67 | throw 'Could not launch $url'; 68 | } 69 | }, 70 | child: const Text(repo, 71 | style: 72 | TextStyle(decoration: TextDecoration.underline))), 73 | spacer24, 74 | Text("SIGNET FAUCET", 75 | style: Theme.of(context).textTheme.headline6), 76 | spacer6, 77 | GestureDetector( 78 | onTap: () async { 79 | final Uri url = Uri.parse(faucet); 80 | if (!await launchUrl(url)) { 81 | throw 'Could not launch $url'; 82 | } 83 | }, 84 | child: const Text(faucet, 85 | style: 86 | TextStyle(decoration: TextDecoration.underline))) 87 | ], 88 | ), 89 | ], 90 | ), 91 | ), 92 | ), 93 | ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /lib/screens/error_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttermint/utils/constants.dart'; 3 | import 'package:fluttermint/widgets/fedi_appbar.dart'; 4 | import 'package:fluttermint/widgets/textured.dart'; 5 | import 'package:go_router/go_router.dart'; 6 | 7 | class ErrorWhy { 8 | final String? title; 9 | final String reason; 10 | 11 | ErrorWhy({this.title, required this.reason}); 12 | } 13 | 14 | class ErrorPage extends StatelessWidget { 15 | final ErrorWhy errorReason; 16 | const ErrorPage({Key? key, required this.errorReason}) : super(key: key); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Textured( 21 | child: Scaffold( 22 | appBar: FediAppBar( 23 | title: "Error", 24 | closeAction: () => context.go("/"), 25 | ), 26 | backgroundColor: Colors.transparent, 27 | body: Padding( 28 | padding: const EdgeInsets.all(48.0), 29 | child: Center( 30 | child: Column( 31 | children: [ 32 | if (errorReason.title != null) ...[ 33 | Text(errorReason.title ?? "", style: errorTitleText), 34 | spacer12, 35 | ], 36 | Text(errorReason.reason, style: errorDescriptionText), 37 | ], 38 | )), 39 | ))); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/screens/send.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:flutter_rust_bridge/flutter_rust_bridge.dart'; 5 | import 'package:fluttermint/data/send.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:fluttermint/screens/error_page.dart'; 8 | import 'package:fluttermint/widgets/button.dart'; 9 | import 'package:mobile_scanner/mobile_scanner.dart'; 10 | import 'package:go_router/go_router.dart'; 11 | 12 | import 'package:fluttermint/widgets/content_padding.dart'; 13 | import 'package:fluttermint/widgets/fedi_appbar.dart'; 14 | import 'package:fluttermint/widgets/textured.dart'; 15 | 16 | import '../ffi.dart'; 17 | import '../widgets/autopaste_text_field.dart'; 18 | 19 | class SendScreen extends ConsumerWidget { 20 | const SendScreen({Key? key}) : super(key: key); 21 | 22 | @override 23 | Widget build(BuildContext context, WidgetRef ref) { 24 | final invoiceController = TextEditingController(); 25 | final sendNotifier = ref.read(sendProvider.notifier); 26 | // final theSend = ref.watch(sendProvider); 27 | 28 | Future tryDecode(String data) async { 29 | try { 30 | debugPrint("decoding: $data"); 31 | if (data.startsWith("lightning:")) { 32 | data = data.split(":")[1]; 33 | } 34 | var decoded = await api.decodeInvoice(bolt11: data.toLowerCase()); 35 | debugPrint("after decoded"); 36 | debugPrint("amount: ${decoded.amount}"); 37 | var send = Send( 38 | description: decoded.description, 39 | amountSats: decoded.amount, 40 | invoice: data); 41 | 42 | debugPrint("Decoded was not null"); 43 | await sendNotifier.createSend(send).then((_) { 44 | context.go("/send/confirm"); 45 | }); 46 | } on FfiException catch (err) { 47 | context.go("/errormodal", 48 | extra: ErrorWhy(title: "Decode Failed", reason: err.message)); 49 | } catch (err) { 50 | context.go("/errormodal", extra: err); 51 | } 52 | } 53 | 54 | // TODO: wire this up so we can do pastes nicer 55 | Future checkIfWeCanSend() async { 56 | if (invoiceController.text.isNotEmpty) { 57 | final invoice = invoiceController.text; 58 | debugPrint('Invoice found! $invoice'); 59 | await tryDecode(invoice.trim()); 60 | } 61 | } 62 | 63 | Future doTheSend() async { 64 | context.go("/send/confirm"); 65 | } 66 | 67 | void onDetect(Barcode barcode, MobileScannerArguments? args) async { 68 | final data = barcode.rawValue; 69 | if (data != null) { 70 | debugPrint('Barcode found! $data'); 71 | await tryDecode(data.trim()); 72 | } 73 | } 74 | 75 | return Textured( 76 | child: Scaffold( 77 | appBar: FediAppBar( 78 | title: "Send bitcoin", 79 | closeAction: () => context.go("/"), 80 | ), 81 | backgroundColor: Colors.transparent, 82 | body: ContentPadding( 83 | child: Column( 84 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 85 | children: [ 86 | // QR scanner doesn't work on other platforms 87 | if (Platform.isAndroid || Platform.isIOS) ...[ 88 | Expanded( 89 | child: ClipRRect( 90 | borderRadius: BorderRadius.circular(8.0), 91 | child: MobileScanner( 92 | allowDuplicates: false, onDetect: onDetect)), 93 | ) 94 | ], 95 | const SizedBox( 96 | height: 16, 97 | ), 98 | AutoPasteTextField( 99 | labelText: "Paste Lightning Invoice", 100 | controller: invoiceController, 101 | initialValue: "", 102 | ), 103 | const SizedBox( 104 | height: 16, 105 | ), 106 | OutlineGradientButton( 107 | primary: true, 108 | // disabled: theSend == null, 109 | text: "Continue", 110 | onTap: () async { 111 | final maybeInvoice = invoiceController.value.text; 112 | await tryDecode(maybeInvoice.trim()); 113 | // context.go("/send/confirm"); 114 | }) 115 | ], 116 | ), 117 | )), 118 | ); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /lib/screens/send_finish.dart: -------------------------------------------------------------------------------- 1 | import 'package:fluttermint/widgets/button.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:go_router/go_router.dart'; 4 | 5 | import 'package:fluttermint/widgets/content_padding.dart'; 6 | import 'package:fluttermint/widgets/fedi_appbar.dart'; 7 | import 'package:fluttermint/widgets/textured.dart'; 8 | 9 | class SendFinish extends StatefulWidget { 10 | const SendFinish({Key? key}) : super(key: key); 11 | 12 | @override 13 | State createState() => _SendFinishState(); 14 | } 15 | 16 | class _SendFinishState extends State { 17 | double scale = 1.0; 18 | 19 | void _changeScale() { 20 | setState(() => scale = scale == 1.0 ? 0.8 : 1.0); 21 | } 22 | 23 | @override 24 | initState() { 25 | super.initState(); 26 | Future(() { 27 | _changeScale(); 28 | }); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Textured( 34 | child: Scaffold( 35 | backgroundColor: Colors.transparent, 36 | appBar: FediAppBar( 37 | title: "Sending...", 38 | closeAction: () { 39 | context.go("/"); 40 | }, 41 | ), 42 | body: ContentPadding( 43 | child: Column( 44 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 45 | children: [ 46 | AnimatedScale( 47 | scale: scale, 48 | duration: const Duration(milliseconds: 1000), 49 | curve: Curves.easeInOutQuad, 50 | onEnd: () => _changeScale(), 51 | child: const Image( 52 | image: AssetImage("assets/app/polygon.png"), 53 | ), 54 | ), 55 | OutlineGradientButton( 56 | text: "Cancel", onTap: () => context.go("/")) 57 | ], 58 | ), 59 | )), 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/screens/setup.dart: -------------------------------------------------------------------------------- 1 | import 'package:fluttermint/utils/constants.dart'; 2 | import 'package:fluttermint/widgets/button.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:go_router/go_router.dart'; 5 | 6 | import 'package:fluttermint/widgets/content_padding.dart'; 7 | import 'package:fluttermint/widgets/textured.dart'; 8 | import 'package:rive/rive.dart'; 9 | 10 | class Setup extends StatelessWidget { 11 | const Setup({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Textured( 16 | child: Scaffold( 17 | backgroundColor: Colors.transparent, 18 | body: ContentPadding( 19 | child: Column( 20 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 21 | children: [ 22 | const Spacer(), 23 | const SizedBox( 24 | width: 295, 25 | height: 295, 26 | child: RiveAnimation.asset("assets/spinny_globe.riv"), 27 | ), 28 | const SizedBox(height: 32), 29 | const Text("Fluttermint", 30 | textAlign: TextAlign.center, 31 | style: TextStyle( 32 | fontFamily: "Archivo 125", 33 | fontSize: 38, 34 | // 3% of 40 35 | letterSpacing: -1.2, 36 | color: white, 37 | fontWeight: FontWeight.w600)), 38 | const Spacer(), 39 | OutlineGradientButton( 40 | text: "Get Started", onTap: () => context.go("/setup/join")) 41 | ], 42 | ), 43 | )), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/utils/constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | const black = Color(0xFF212121); 4 | const grey = Color.fromRGBO(255, 255, 255, 0.498); 5 | const disabledGrey = Color(0xFFC4C4C4); 6 | const offwhite = Color(0xFFA0A0A0); 7 | const white = Color(0xFFF1F1F1); 8 | const whiteFaded = Color(0xCCF1F1F1); // 0.8 opacity 9 | 10 | Map color = { 11 | 50: const Color.fromRGBO(241, 241, 241, .1), 12 | 100: const Color.fromRGBO(241, 241, 241, .2), 13 | 200: const Color.fromRGBO(241, 241, 241, .3), 14 | 300: const Color.fromRGBO(241, 241, 241, .4), 15 | 400: const Color.fromRGBO(241, 241, 241, .5), 16 | 500: const Color.fromRGBO(241, 241, 241, .6), 17 | 600: const Color.fromRGBO(241, 241, 241, .7), 18 | 700: const Color.fromRGBO(241, 241, 241, .8), 19 | 800: const Color.fromRGBO(241, 241, 241, .9), 20 | 900: const Color.fromRGBO(241, 241, 241, 1), 21 | }; 22 | 23 | MaterialColor materialWhite = MaterialColor(0xFFF1F1F1, color); 24 | 25 | const spacer12 = SizedBox( 26 | height: 12.0, 27 | width: 12.0, 28 | ); 29 | const spacer24 = SizedBox(height: 24.0, width: 12.0); 30 | const spacer6 = SizedBox(height: 6.0, width: 6.0); 31 | const spacer0 = SizedBox.shrink(); 32 | 33 | const navTitleText = TextStyle( 34 | fontFamily: "Albert Sans", 35 | color: white, 36 | fontSize: 16, 37 | fontWeight: FontWeight.w500, 38 | ); 39 | 40 | const errorTitleText = TextStyle( 41 | fontFamily: "Archivo 125", 42 | color: white, 43 | fontSize: 16, 44 | fontWeight: FontWeight.w500, 45 | ); 46 | 47 | const paymentDescriptionText = TextStyle( 48 | fontFamily: "Albert Sans", 49 | color: white, 50 | fontSize: 14, 51 | fontWeight: FontWeight.w400, 52 | ); 53 | 54 | const errorDescriptionText = paymentDescriptionText; 55 | 56 | const smallBalanceText = TextStyle( 57 | fontFamily: "Archivo 125", 58 | color: white, 59 | fontSize: 28, 60 | fontWeight: FontWeight.w400, 61 | ); 62 | 63 | const TextTheme textThemeDefault = TextTheme( 64 | headline1: TextStyle( 65 | fontFamily: "Archivo 125", 66 | color: white, 67 | fontSize: 64, 68 | fontWeight: FontWeight.w500, 69 | ), 70 | headline2: TextStyle( 71 | fontFamily: "Archivo 125", 72 | color: white, 73 | fontSize: 22, 74 | fontWeight: FontWeight.w500, 75 | ), 76 | headline3: TextStyle( 77 | fontFamily: "Archivo", 78 | color: white, 79 | fontSize: 18, 80 | fontWeight: FontWeight.w400), 81 | // Body 2 in the Figma 82 | headline4: TextStyle( 83 | fontFamily: "Archivo", 84 | color: white, 85 | fontSize: 16, 86 | fontWeight: FontWeight.w600), 87 | // Smaller balance display 88 | headline5: TextStyle( 89 | fontFamily: "Archivo 125", 90 | color: white, 91 | fontSize: 28, 92 | fontWeight: FontWeight.w400), 93 | // Unit for smaller balance display 94 | headline6: TextStyle( 95 | fontFamily: "Archivo 125", 96 | color: white, 97 | fontSize: 18, 98 | fontWeight: FontWeight.w500, 99 | ), 100 | bodyText1: TextStyle(color: white, fontSize: 14, height: 1.5), 101 | bodyText2: TextStyle( 102 | color: Color(0xCCF1F1F1), fontSize: 14, fontWeight: FontWeight.w400), 103 | subtitle1: TextStyle(color: white, fontSize: 16, fontWeight: FontWeight.w400), 104 | subtitle2: TextStyle(color: grey, fontSize: 12), 105 | caption: TextStyle(color: black, fontSize: 12), 106 | ); 107 | -------------------------------------------------------------------------------- /lib/utils/network_detector_notifier.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:connectivity/connectivity.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | 6 | enum NetworkStatus { NotDetermined, On, Off } 7 | 8 | class NetworkDetectorNotifier extends StateNotifier { 9 | StreamController controller = 10 | StreamController(); 11 | 12 | late NetworkStatus lastResult; 13 | 14 | NetworkDetectorNotifier() : super(NetworkStatus.NotDetermined) { 15 | lastResult = NetworkStatus.NotDetermined; 16 | Connectivity().onConnectivityChanged.listen((ConnectivityResult result) { 17 | // Use Connectivity() here to gather more info if you need t 18 | NetworkStatus newState; 19 | switch (result) { 20 | case ConnectivityResult.mobile: 21 | case ConnectivityResult.wifi: 22 | newState = NetworkStatus.On; 23 | break; 24 | case ConnectivityResult.none: 25 | newState = NetworkStatus.Off; 26 | break; 27 | } 28 | 29 | if (newState != state) { 30 | state = newState; 31 | } 32 | }); 33 | } 34 | } 35 | 36 | final networkAwareProvider = 37 | StateNotifierProvider.autoDispose( 38 | (ref) { 39 | return NetworkDetectorNotifier(); 40 | }); 41 | -------------------------------------------------------------------------------- /lib/utils/unimplemented.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | Future unimplementedDialog(BuildContext context) { 4 | return showDialog( 5 | context: context, 6 | builder: (BuildContext context) => AlertDialog( 7 | title: const Text('Unimplemented'), 8 | content: const Text("This doesn't work yet"), 9 | actions: [ 10 | TextButton( 11 | onPressed: () => Navigator.pop(context, 'OK'), 12 | child: const Text('OK'), 13 | ), 14 | ], 15 | ), 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /lib/widgets/autopaste_text_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:fluttermint/utils/constants.dart'; 4 | 5 | class AutoPasteTextField extends StatelessWidget { 6 | const AutoPasteTextField( 7 | {Key? key, 8 | this.initialValue, 9 | required this.controller, 10 | required this.labelText}) 11 | : super(key: key); 12 | 13 | final String labelText; 14 | final String? initialValue; 15 | final TextEditingController controller; 16 | 17 | void _clearText() { 18 | controller.clear(); 19 | } 20 | 21 | void _setTextFromClipboard() { 22 | Clipboard.getData(Clipboard.kTextPlain).then((value) { 23 | if (value != null) { 24 | controller.text = "${value.text?.trim()}"; 25 | } 26 | }); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | controller.text = initialValue ?? ""; 32 | return Column( 33 | children: [ 34 | Focus( 35 | onFocusChange: (hasFocus) { 36 | if (hasFocus) { 37 | _setTextFromClipboard(); 38 | } 39 | }, 40 | child: TextField( 41 | controller: controller, 42 | decoration: InputDecoration( 43 | labelText: labelText, 44 | enabledBorder: OutlineInputBorder( 45 | borderRadius: BorderRadius.circular(8), 46 | borderSide: const BorderSide(width: 1, color: white)), 47 | focusedBorder: OutlineInputBorder( 48 | borderRadius: BorderRadius.circular(8), 49 | borderSide: const BorderSide(width: 1, color: white)), 50 | suffixIcon: controller.text.isNotEmpty 51 | ? IconButton( 52 | icon: const Icon(Icons.clear), 53 | onPressed: _clearText, 54 | ) 55 | : null), 56 | ), 57 | ), 58 | ], 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/widgets/balance_display.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:fluttermint/data/balance.dart'; 4 | import 'package:fluttermint/utils/constants.dart'; 5 | 6 | // FIXME: How do we get a initial value 7 | final balanceStreamProvider = StreamProvider.autoDispose((ref) { 8 | Stream getBalance() async* { 9 | var shouldPoll = true; 10 | await ref.read(balanceProvider.notifier).refreshBalance(); 11 | while (shouldPoll) { 12 | try { 13 | await Future.delayed(const Duration(seconds: 1)); 14 | await ref.read(balanceProvider.notifier).refreshBalance(); 15 | yield "good"; 16 | } catch (e) { 17 | yield null; 18 | } 19 | } 20 | } 21 | 22 | return getBalance(); 23 | }); 24 | 25 | class BalanceDisplay extends ConsumerWidget { 26 | const BalanceDisplay({ 27 | required this.initialBalance, 28 | this.small = false, 29 | Key? key, 30 | }) : super(key: key); 31 | 32 | final Balance initialBalance; 33 | final bool small; 34 | 35 | @override 36 | Widget build(BuildContext context, WidgetRef ref) { 37 | final balance = ref.watch(balanceProvider); 38 | final balanceNotifier = ref.watch(balanceProvider.notifier); 39 | final balanceStreamWatcher = ref.watch(balanceStreamProvider); 40 | 41 | return GestureDetector( 42 | onTap: () => {balanceNotifier.switchDenom()}, 43 | child: balanceStreamWatcher.when( 44 | data: (_) => ActualBalanceDisplay( 45 | small: small, balance: balance ?? const Balance(amountSats: 0)), 46 | loading: () => ActualBalanceDisplay( 47 | small: small, 48 | balance: initialBalance, 49 | ), 50 | error: (err, _) => Text(err.toString())), 51 | ); 52 | } 53 | } 54 | 55 | class ActualBalanceDisplay extends StatelessWidget { 56 | const ActualBalanceDisplay( 57 | {Key? key, required this.balance, this.small = false}) 58 | : super(key: key); 59 | 60 | final Balance balance; 61 | final bool small; 62 | 63 | @override 64 | Widget build(BuildContext context) { 65 | final biggestText = Theme.of(context).textTheme.headline1; 66 | final bigText = 67 | Theme.of(context).textTheme.headline1?.copyWith(fontSize: 44); 68 | final smallText = 69 | Theme.of(context).textTheme.headline2?.copyWith(color: whiteFaded); 70 | 71 | return small 72 | ? Row(mainAxisAlignment: MainAxisAlignment.center, children: [ 73 | Text(balance.prettyPrint(), style: smallBalanceText), 74 | const SizedBox(width: 4), 75 | Text(balance.denomination.toReadableString(), 76 | style: smallBalanceText.copyWith(color: whiteFaded)), 77 | ]) 78 | : Column( 79 | children: [ 80 | Text(balance.prettyPrint(), 81 | style: balance.denomination == Denom.sats 82 | ? biggestText 83 | : bigText), 84 | Text(balance.denomination.toReadableString(), style: smallText), 85 | ], 86 | ); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/widgets/chill_info_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttermint/utils/constants.dart'; 3 | 4 | class ChillInfoCard extends StatelessWidget { 5 | final Widget child; 6 | final bool? warning; 7 | const ChillInfoCard({Key? key, required this.child, this.warning}) 8 | : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | width: double.infinity, 14 | decoration: BoxDecoration( 15 | borderRadius: const BorderRadius.all(Radius.circular(12)), 16 | // Box decoration takes a gradient 17 | gradient: LinearGradient( 18 | // Where the linear gradient begins and ends 19 | begin: Alignment.topCenter, 20 | end: Alignment.bottomCenter, 21 | // Add one stop for each color. Stops should increase from 0 to 1 22 | colors: [ 23 | white.withOpacity(warning != null ? 0.8 : 0.2), 24 | white.withOpacity(warning != null ? 0.2 : 0.04) 25 | ], 26 | ), 27 | ), 28 | child: Padding(padding: const EdgeInsets.all(20), child: child)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/widgets/content_padding.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ContentPadding extends StatelessWidget { 4 | final Widget child; 5 | 6 | const ContentPadding({ 7 | Key? key, 8 | required this.child, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Padding( 14 | padding: const EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 24.0), 15 | child: child); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/widgets/data_expander.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttermint/widgets/toggle.dart'; 3 | 4 | class DataExpander extends StatefulWidget { 5 | const DataExpander({Key? key, required this.child}) : super(key: key); 6 | 7 | final Widget child; 8 | 9 | @override 10 | State createState() => _DataExpanderState(); 11 | } 12 | 13 | class _DataExpanderState extends State { 14 | bool _first = true; 15 | 16 | void _toggle() { 17 | setState(() => _first = !_first); 18 | } 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return AnimatedCrossFade( 23 | sizeCurve: Curves.easeInOutQuad, 24 | firstChild: Toggle( 25 | active: false, 26 | onToggle: _toggle, 27 | ), 28 | secondChild: Column( 29 | children: [ 30 | widget.child, 31 | const SizedBox(height: 16), 32 | Toggle(onToggle: _toggle, active: true) 33 | ], 34 | ), 35 | crossFadeState: 36 | _first ? CrossFadeState.showFirst : CrossFadeState.showSecond, 37 | duration: const Duration(milliseconds: 200), 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/widgets/ellipsable_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | extension on String { 4 | List splitByLength(int length) => 5 | [substring(0, length), substring(length)]; 6 | } 7 | 8 | class EllipsableText extends StatelessWidget { 9 | const EllipsableText({Key? key, required this.text, required this.style}) 10 | : super(key: key); 11 | 12 | final String text; 13 | final TextStyle? style; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Row( 18 | children: [ 19 | Flexible( 20 | child: Text(text.splitByLength(text.length - 8)[0], 21 | maxLines: 1, overflow: TextOverflow.ellipsis, style: style), 22 | ), 23 | Text( 24 | text.splitByLength(text.length - 8)[1], 25 | style: style, 26 | ), 27 | ], 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/widgets/fedi_appbar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttermint/utils/constants.dart'; 3 | 4 | class FediAppBar extends StatelessWidget implements PreferredSizeWidget { 5 | final String title; 6 | final void Function()? backAction; 7 | final void Function()? closeAction; 8 | 9 | const FediAppBar({ 10 | Key? key, 11 | required this.title, 12 | this.backAction, 13 | this.closeAction, 14 | }) : super(key: key); 15 | 16 | @override 17 | Size get preferredSize => const Size.fromHeight(120); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return Padding( 22 | padding: const EdgeInsets.all(24.0), 23 | child: Row( 24 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 25 | crossAxisAlignment: CrossAxisAlignment.center, 26 | children: [ 27 | backAction != null 28 | ? SimpleIconButton( 29 | action: backAction, 30 | icon: Icons.arrow_back, 31 | semanticLabel: "Back", 32 | ) 33 | : const ButtonSizedSpacer(), 34 | Text(title, style: navTitleText), 35 | SimpleIconButton( 36 | action: closeAction, 37 | icon: Icons.close, 38 | semanticLabel: "Close", 39 | ), 40 | ], 41 | ), 42 | ); 43 | } 44 | } 45 | 46 | class ButtonSizedSpacer extends StatelessWidget { 47 | const ButtonSizedSpacer({ 48 | Key? key, 49 | }) : super(key: key); 50 | 51 | @override 52 | Widget build(BuildContext context) { 53 | return Container( 54 | padding: const EdgeInsets.all(8.0), 55 | child: const SizedBox(width: 24.0, height: 24.0)); 56 | } 57 | } 58 | 59 | class SimpleIconButton extends StatelessWidget { 60 | const SimpleIconButton({ 61 | Key? key, 62 | required this.action, 63 | required this.icon, 64 | required this.semanticLabel, 65 | }) : super(key: key); 66 | 67 | final void Function()? action; 68 | final IconData icon; 69 | final String semanticLabel; 70 | 71 | @override 72 | Widget build(BuildContext context) { 73 | return InkWell( 74 | borderRadius: const BorderRadius.all(Radius.circular(8.0)), 75 | onTap: action, 76 | child: Container( 77 | padding: const EdgeInsets.all(8.0), 78 | child: Icon( 79 | icon, 80 | color: Theme.of(context).primaryColor, 81 | size: 24.0, 82 | semanticLabel: semanticLabel, 83 | ), 84 | ), 85 | ); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/widgets/fedi_tooltip.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttermint/utils/constants.dart'; 3 | 4 | class FediTooltip extends StatelessWidget { 5 | const FediTooltip({Key? key, required this.child, required this.title}) 6 | : super(key: key); 7 | 8 | final String title; 9 | final Widget child; 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | // final GlobalKey tooltipkey = GlobalKey(); 14 | 15 | return Tooltip( 16 | // Provide a global key with the "TooltipState" type to show 17 | // the tooltip manually when trigger mode is set to manual. 18 | // key: tooltipkey.currentState?.ensureTooltipVisible(), 19 | triggerMode: TooltipTriggerMode.manual, 20 | key: key, 21 | showDuration: const Duration(seconds: 1), 22 | waitDuration: const Duration(seconds: 1), 23 | message: 'I am a Tooltip?', 24 | padding: const EdgeInsets.all(14.0), 25 | textStyle: const TextStyle( 26 | fontSize: 14.0, color: black, fontWeight: FontWeight.w500), 27 | preferBelow: false, 28 | decoration: BoxDecoration( 29 | borderRadius: BorderRadius.circular(12), 30 | boxShadow: [ 31 | BoxShadow( 32 | blurRadius: 4.0, 33 | offset: const Offset(0.0, 4.0), 34 | color: Colors.black.withOpacity(0.3)) 35 | ], 36 | gradient: const LinearGradient( 37 | begin: Alignment.topCenter, 38 | end: Alignment.bottomCenter, 39 | colors: [white, Color(0xffc3c3c3)]), 40 | ), 41 | child: Padding( 42 | padding: const EdgeInsets.all(14.0), 43 | child: child, 44 | ), 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/widgets/logo_action.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_platform_widgets/flutter_platform_widgets.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:fluttermint/ffi.dart'; 5 | import 'package:go_router/go_router.dart'; 6 | 7 | import '../utils/constants.dart'; 8 | 9 | class FedimintLogoAction extends ConsumerWidget { 10 | const FedimintLogoAction({ 11 | Key? key, 12 | }) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context, WidgetRef ref) { 16 | return GestureDetector( 17 | onTap: () => {context.go("/about")}, 18 | onLongPress: () => { 19 | showPlatformDialog( 20 | context: context, 21 | builder: (_) => PlatformAlertDialog( 22 | title: const Text('Leave Federation?'), 23 | content: const Text( 24 | 'Are you sure you want to leave this federation? All your e-cash will be lost!'), 25 | actions: [ 26 | PlatformDialogAction( 27 | onPressed: () => Navigator.pop(context, 'Cancel'), 28 | child: const Text("Cancel")), 29 | PlatformDialogAction( 30 | onPressed: () async { 31 | context.go("/setup"); 32 | await api.leaveFederation(); 33 | }, 34 | child: const Text("Ok")), 35 | ], 36 | ), 37 | ) 38 | }, 39 | child: Row( 40 | mainAxisAlignment: MainAxisAlignment.center, 41 | crossAxisAlignment: CrossAxisAlignment.center, 42 | children: const [ 43 | Padding( 44 | padding: EdgeInsets.all(8.0), 45 | child: Text( 46 | "Fluttermint", 47 | style: TextStyle( 48 | fontFamily: "Archivo 125", 49 | fontSize: 18, 50 | color: white, 51 | fontWeight: FontWeight.w600), 52 | ), 53 | ) 54 | ], 55 | ), 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/widgets/not_connected_warning.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttermint/bridge_generated.dart'; 3 | import 'package:fluttermint/utils/constants.dart'; 4 | import 'package:fluttermint/utils/network_detector_notifier.dart'; 5 | import 'package:fluttermint/widgets/chill_info_card.dart'; 6 | 7 | class NotConnectedWarning extends StatelessWidget { 8 | const NotConnectedWarning( 9 | {super.key, this.connectionStatus, this.networkStatus}); 10 | 11 | final ConnectionStatus? connectionStatus; 12 | final NetworkStatus? networkStatus; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | final message = networkStatus == NetworkStatus.Off 17 | ? "No Internet Connection Detected" 18 | : connectionStatus == ConnectionStatus.NotConnected 19 | ? "Couldn't Connect To Federation" 20 | : null; 21 | 22 | return message != null 23 | ? Column( 24 | children: [ 25 | ChillInfoCard( 26 | warning: true, 27 | child: Column( 28 | children: [ 29 | Text("Warning", 30 | style: Theme.of(context).textTheme.headline6), 31 | spacer12, 32 | Text(message, style: Theme.of(context).textTheme.subtitle1), 33 | ], 34 | ), 35 | ), 36 | spacer24 37 | ], 38 | ) 39 | : const SizedBox( 40 | height: 0, 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/widgets/outline_gradient.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class OutlinePainter extends CustomPainter { 4 | final Gradient gradient; 5 | final Radius? radius; 6 | final double strokeWidth; 7 | 8 | OutlinePainter(this.gradient, this.radius, this.strokeWidth); 9 | 10 | @override 11 | void paint(Canvas canvas, Size size) { 12 | final Rect rect = Rect.fromLTWH(strokeWidth / 2, strokeWidth / 2, 13 | size.width - strokeWidth, size.height - strokeWidth); 14 | final RRect rRect = RRect.fromRectAndRadius(rect, radius ?? Radius.zero); 15 | final Paint paint = Paint() 16 | ..style = PaintingStyle.stroke 17 | ..strokeWidth = strokeWidth 18 | ..shader = gradient.createShader(rect); 19 | canvas.drawRRect(rRect, paint); 20 | } 21 | 22 | @override 23 | bool shouldRepaint(CustomPainter oldDelegate) => oldDelegate != this; 24 | } 25 | -------------------------------------------------------------------------------- /lib/widgets/qr_display.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttermint/utils/constants.dart'; 3 | import 'package:fluttermint/widgets/ellipsable_text.dart'; 4 | import 'package:qr_flutter/qr_flutter.dart'; 5 | 6 | class QrDisplay extends StatelessWidget { 7 | const QrDisplay({ 8 | Key? key, 9 | required this.data, 10 | required this.displayText, 11 | }) : super(key: key); 12 | 13 | final String data; 14 | final String displayText; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Container( 19 | decoration: const BoxDecoration( 20 | borderRadius: BorderRadius.all(Radius.circular(12)), 21 | color: white, 22 | ), 23 | child: Padding( 24 | padding: const EdgeInsets.all(20.0), 25 | child: Column( 26 | children: [ 27 | // debugPrint(constraints.toString()); 28 | Container( 29 | constraints: BoxConstraints( 30 | maxHeight: (MediaQuery.of(context).size.height / 2)), 31 | child: AspectRatio( 32 | aspectRatio: 1.0, 33 | child: Padding( 34 | padding: const EdgeInsets.all(12.0), 35 | child: QrImage( 36 | data: data, 37 | version: QrVersions.auto, 38 | ), 39 | ), 40 | ), 41 | ), 42 | EllipsableText( 43 | text: displayText, style: Theme.of(context).textTheme.caption), 44 | ], 45 | ), 46 | ), 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/widgets/reassemble_listener.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | class ReassembleListener extends StatefulWidget { 4 | const ReassembleListener( 5 | {Key? key, required this.onReassemble, required this.child}) 6 | : super(key: key); 7 | 8 | final VoidCallback onReassemble; 9 | final Widget child; 10 | 11 | @override 12 | _ReassembleListenerState createState() => _ReassembleListenerState(); 13 | } 14 | 15 | class _ReassembleListenerState extends State { 16 | @override 17 | void reassemble() { 18 | super.reassemble(); 19 | if (widget.onReassemble != null) { 20 | widget.onReassemble(); 21 | } 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return widget.child; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/widgets/scroll_if_u_want.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // This is basically SingleChildScrollView except it works the way I want it to 4 | class ScrollIfYouWant extends StatelessWidget { 5 | const ScrollIfYouWant({super.key, required this.child}); 6 | 7 | final Widget child; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return CustomScrollView(slivers: [SliverFillRemaining(child: child)]); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/widgets/single_tx.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttermint/bridge_generated.dart'; 3 | import 'package:fluttermint/data/transactions.dart'; 4 | import 'package:fluttermint/utils/constants.dart'; 5 | 6 | class SingleTx extends StatelessWidget { 7 | SingleTx({Key? key, required this.tx}) : super(key: key); 8 | 9 | final Transaction tx; 10 | 11 | String fmtSats(int sats, PaymentDirection direction) { 12 | if (direction == PaymentDirection.Incoming) { 13 | return '+$sats sats'; 14 | } else { 15 | return '-$sats sats'; 16 | } 17 | } 18 | 19 | final small = 20 | TextStyle(color: white.withOpacity(0.7), fontSize: 12, height: 1.5); 21 | final med = const TextStyle(color: white, fontSize: 15, height: 1.5); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Opacity( 26 | opacity: tx.status == "Pending" || tx.status == "Expired" ? 0.6 : 1.0, 27 | child: Padding( 28 | padding: const EdgeInsets.symmetric(horizontal: 12.0), 29 | child: Container( 30 | padding: const EdgeInsets.symmetric(vertical: 12.0), 31 | decoration: const BoxDecoration( 32 | border: Border(bottom: BorderSide(color: disabledGrey))), 33 | child: Column( 34 | children: [ 35 | Row( 36 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 37 | children: [ 38 | Text(tx.status, style: med), 39 | Text(fmtSats(tx.amountSats, tx.direction), style: med) 40 | ], 41 | ), 42 | Row( 43 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 44 | children: [ 45 | Flexible( 46 | child: Text( 47 | style: small, 48 | tx.description.isEmpty 49 | ? "No description" 50 | : tx.description, 51 | overflow: TextOverflow.ellipsis, 52 | maxLines: 1, 53 | ), 54 | ), 55 | spacer12, 56 | Text(tx.when) 57 | ], 58 | ) 59 | ], 60 | ), 61 | ), 62 | ), 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/widgets/textured.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Textured extends StatelessWidget { 4 | final Widget child; 5 | 6 | const Textured({ 7 | Key? key, 8 | required this.child, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container( 14 | decoration: const BoxDecoration( 15 | image: DecorationImage( 16 | image: AssetImage("assets/app/bg-dark.png"), fit: BoxFit.cover)), 17 | child: SafeArea(child: child), 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/widgets/toggle.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:math'; 3 | 4 | class Toggle extends StatelessWidget { 5 | const Toggle({Key? key, required this.onToggle, required this.active}) 6 | : super(key: key); 7 | 8 | final VoidCallback onToggle; 9 | final bool active; 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return InkWell( 14 | borderRadius: BorderRadius.circular(8.0), 15 | onTap: () => onToggle(), 16 | child: SizedBox( 17 | width: double.infinity, 18 | child: Padding( 19 | padding: const EdgeInsets.all(8.0), 20 | child: Column( 21 | children: [ 22 | active 23 | ? Transform.rotate( 24 | angle: pi, 25 | child: Icon( 26 | Icons.expand_more, 27 | color: Theme.of(context).primaryColor, 28 | size: 24.0, 29 | semanticLabel: 'Minimize', 30 | ), 31 | ) 32 | : Icon( 33 | Icons.expand_more, 34 | color: Theme.of(context).primaryColor, 35 | size: 24.0, 36 | semanticLabel: 'Expand', 37 | ), 38 | ], 39 | ), 40 | ), 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/widgets/transaction_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:fluttermint/data/transactions.dart'; 4 | import 'package:fluttermint/utils/constants.dart'; 5 | import 'package:fluttermint/widgets/single_tx.dart'; 6 | import 'package:fluttermint/widgets/toggle.dart'; 7 | 8 | final showTransactionsProvider = StateProvider((ref) => false); 9 | 10 | class SingleTransaction extends StatelessWidget { 11 | const SingleTransaction({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Container(); 16 | } 17 | } 18 | 19 | class TransactionsList extends ConsumerWidget { 20 | const TransactionsList({ 21 | Key? key, 22 | }) : super(key: key); 23 | 24 | @override 25 | Widget build(BuildContext context, WidgetRef ref) { 26 | final transactions = ref.watch(transactionsProvider); 27 | final transactionsNotifier = ref.watch(transactionsProvider.notifier); 28 | 29 | final showTransactions = ref.watch(showTransactionsProvider); 30 | 31 | return Padding( 32 | padding: const EdgeInsets.symmetric(horizontal: 24.0), 33 | child: Column(children: [ 34 | Toggle( 35 | onToggle: () async { 36 | // TODO: need a more canonical place to do this 37 | await transactionsNotifier.fetchTransactions(); 38 | ref 39 | .read(showTransactionsProvider.notifier) 40 | .update((show) => !show); 41 | }, 42 | active: showTransactions), 43 | showTransactions 44 | ? Expanded( 45 | child: ShaderMask( 46 | shaderCallback: (Rect bounds) { 47 | return const LinearGradient( 48 | begin: Alignment.topCenter, 49 | end: Alignment.bottomCenter, 50 | colors: [ 51 | Colors.black, 52 | Colors.transparent, 53 | Colors.transparent, 54 | Colors.black 55 | ], 56 | stops: [ 57 | 0.0, 58 | 0.05, 59 | 0.95, 60 | 1.0 61 | ]).createShader(bounds); 62 | }, 63 | blendMode: BlendMode.dstOut, 64 | child: ListView(shrinkWrap: true, children: [ 65 | if (transactions.txs.isEmpty) ...[ 66 | spacer24, 67 | const Center(child: Text("No transactions")) 68 | ], 69 | ...transactions.txs.map((tx) => SingleTx(tx: tx)) 70 | ]), 71 | ), 72 | ) 73 | : const SizedBox.shrink() 74 | ]), 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /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 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 14 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /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 | url_launcher_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /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, "fluttermint"); 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, "fluttermint"); 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 connectivity_macos 9 | import mobile_scanner 10 | import package_info_plus_macos 11 | import path_provider_macos 12 | import share_plus_macos 13 | import url_launcher_macos 14 | 15 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 16 | ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) 17 | MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin")) 18 | FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) 19 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 20 | SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) 21 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 22 | } 23 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '12.3' 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/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - connectivity_macos (0.0.1): 3 | - FlutterMacOS 4 | - Reachability 5 | - FlutterMacOS (1.0.0) 6 | - mobile_scanner (0.0.1): 7 | - FlutterMacOS 8 | - package_info_plus_macos (0.0.1): 9 | - FlutterMacOS 10 | - path_provider_macos (0.0.1): 11 | - FlutterMacOS 12 | - Reachability (3.2) 13 | - share_plus_macos (0.0.1): 14 | - FlutterMacOS 15 | - url_launcher_macos (0.0.1): 16 | - FlutterMacOS 17 | 18 | DEPENDENCIES: 19 | - connectivity_macos (from `Flutter/ephemeral/.symlinks/plugins/connectivity_macos/macos`) 20 | - FlutterMacOS (from `Flutter/ephemeral`) 21 | - mobile_scanner (from `Flutter/ephemeral/.symlinks/plugins/mobile_scanner/macos`) 22 | - package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`) 23 | - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) 24 | - share_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos`) 25 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 26 | 27 | SPEC REPOS: 28 | trunk: 29 | - Reachability 30 | 31 | EXTERNAL SOURCES: 32 | connectivity_macos: 33 | :path: Flutter/ephemeral/.symlinks/plugins/connectivity_macos/macos 34 | FlutterMacOS: 35 | :path: Flutter/ephemeral 36 | mobile_scanner: 37 | :path: Flutter/ephemeral/.symlinks/plugins/mobile_scanner/macos 38 | package_info_plus_macos: 39 | :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos 40 | path_provider_macos: 41 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos 42 | share_plus_macos: 43 | :path: Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos 44 | url_launcher_macos: 45 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 46 | 47 | SPEC CHECKSUMS: 48 | connectivity_macos: 5dae6ee11d320fac7c05f0d08bd08fc32b5514d9 49 | FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811 50 | mobile_scanner: 35dc92ffdbd7934b0dbc411b1c731bc2ef23c2dc 51 | package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c 52 | path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 53 | Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 54 | share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4 55 | url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 56 | 57 | PODFILE CHECKSUM: 9c287df83456b84329f6ecc46f20e235558c2010 58 | 59 | COCOAPODS: 1.11.3 60 | -------------------------------------------------------------------------------- /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 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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 | // http://cjycode.com/flutter_rust_bridge/integrate/ios_headers.html 8 | dummy_method_to_enforce_bundling() 9 | return true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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 = fluttermint 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.fluttermint 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | com.apple.security.network.client 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Runner/bridge_generated.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | typedef struct wire_uint_8_list { 6 | uint8_t *ptr; 7 | int32_t len; 8 | } wire_uint_8_list; 9 | 10 | typedef struct wire_BridgeGuardianInfo { 11 | struct wire_uint_8_list *name; 12 | struct wire_uint_8_list *address; 13 | bool online; 14 | } wire_BridgeGuardianInfo; 15 | 16 | typedef struct wire_list_bridge_guardian_info { 17 | struct wire_BridgeGuardianInfo *ptr; 18 | int32_t len; 19 | } wire_list_bridge_guardian_info; 20 | 21 | typedef struct wire_BridgeFederationInfo { 22 | struct wire_uint_8_list *name; 23 | struct wire_uint_8_list *network; 24 | bool current; 25 | struct wire_list_bridge_guardian_info *guardians; 26 | } wire_BridgeFederationInfo; 27 | 28 | typedef struct WireSyncReturnStruct { 29 | uint8_t *ptr; 30 | int32_t len; 31 | bool success; 32 | } WireSyncReturnStruct; 33 | 34 | typedef int64_t DartPort; 35 | 36 | typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message); 37 | 38 | void wire_init(int64_t port_, struct wire_uint_8_list *path); 39 | 40 | void wire_join_federation(int64_t port_, struct wire_uint_8_list *config_url); 41 | 42 | void wire_leave_federation(int64_t port_); 43 | 44 | void wire_balance(int64_t port_); 45 | 46 | void wire_pay(int64_t port_, struct wire_uint_8_list *bolt11); 47 | 48 | void wire_invoice(int64_t port_, uint64_t amount, struct wire_uint_8_list *description); 49 | 50 | void wire_fetch_payment(int64_t port_, struct wire_uint_8_list *payment_hash); 51 | 52 | void wire_list_payments(int64_t port_); 53 | 54 | void wire_configured_status(int64_t port_); 55 | 56 | void wire_connection_status(int64_t port_); 57 | 58 | void wire_network(int64_t port_); 59 | 60 | void wire_calculate_fee(int64_t port_, struct wire_uint_8_list *bolt11); 61 | 62 | void wire_list_federations(int64_t port_); 63 | 64 | void wire_switch_federation(int64_t port_, struct wire_BridgeFederationInfo *_federation); 65 | 66 | void wire_decode_invoice(int64_t port_, struct wire_uint_8_list *bolt11); 67 | 68 | struct wire_BridgeFederationInfo *new_box_autoadd_bridge_federation_info_0(void); 69 | 70 | struct wire_list_bridge_guardian_info *new_list_bridge_guardian_info_0(int32_t len); 71 | 72 | struct wire_uint_8_list *new_uint_8_list_0(int32_t len); 73 | 74 | void free_WireSyncReturnStruct(struct WireSyncReturnStruct val); 75 | 76 | void store_dart_post_cobject(DartPostCObjectFnType ptr); 77 | 78 | static int64_t dummy_method_to_enforce_bundling(void) { 79 | int64_t dummy_var = 0; 80 | dummy_var ^= ((int64_t) (void*) wire_init); 81 | dummy_var ^= ((int64_t) (void*) wire_join_federation); 82 | dummy_var ^= ((int64_t) (void*) wire_leave_federation); 83 | dummy_var ^= ((int64_t) (void*) wire_balance); 84 | dummy_var ^= ((int64_t) (void*) wire_pay); 85 | dummy_var ^= ((int64_t) (void*) wire_invoice); 86 | dummy_var ^= ((int64_t) (void*) wire_fetch_payment); 87 | dummy_var ^= ((int64_t) (void*) wire_list_payments); 88 | dummy_var ^= ((int64_t) (void*) wire_configured_status); 89 | dummy_var ^= ((int64_t) (void*) wire_connection_status); 90 | dummy_var ^= ((int64_t) (void*) wire_network); 91 | dummy_var ^= ((int64_t) (void*) wire_calculate_fee); 92 | dummy_var ^= ((int64_t) (void*) wire_list_federations); 93 | dummy_var ^= ((int64_t) (void*) wire_switch_federation); 94 | dummy_var ^= ((int64_t) (void*) wire_decode_invoice); 95 | dummy_var ^= ((int64_t) (void*) new_box_autoadd_bridge_federation_info_0); 96 | dummy_var ^= ((int64_t) (void*) new_list_bridge_guardian_info_0); 97 | dummy_var ^= ((int64_t) (void*) new_uint_8_list_0); 98 | dummy_var ^= ((int64_t) (void*) free_WireSyncReturnStruct); 99 | dummy_var ^= ((int64_t) (void*) store_dart_post_cobject); 100 | return dummy_var; 101 | } -------------------------------------------------------------------------------- /minimint-bridge/.cargo/ar.aarch64-linux-android: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec "$AR_aarch64_linux_android" "$ARFLAGS_aarch64_linux_android" "$@" 4 | -------------------------------------------------------------------------------- /minimint-bridge/.cargo/ar.armv7-linux-androideabi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec "$AR_armv7_linux_androideabi" "$ARFLAGS_armv7_linux_androideabi" "$@" 4 | -------------------------------------------------------------------------------- /minimint-bridge/.cargo/ar.i686-linux-android: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec "$AR_i686_linux_android" "$ARFLAGS_i686_linux_android" "$@" 4 | -------------------------------------------------------------------------------- /minimint-bridge/.cargo/ar.x86_64-linux-android: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec "$AR_x86_64_linux_android" "$ARFLAGS_x86_64_linux_android" "$@" 4 | -------------------------------------------------------------------------------- /minimint-bridge/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.armv7-linux-androideabi] 2 | linker = "./.cargo/ld.armv7-linux-androideabi" 3 | ar = "./.cargo/ar.armv7-linux-androideabi" 4 | 5 | [target.aarch64-linux-android] 6 | linker = "./.cargo/ld.aarch64-linux-android" 7 | ar = "./.cargo/ar.aarch64-linux-android" 8 | 9 | [target.x86_64-linux-android] 10 | linker = "./.cargo/ld.x86_64-linux-android" 11 | ar = "./.cargo/ar.x86_64-linux-android" 12 | 13 | [target.i686-linux-android] 14 | linker = "./.cargo/ld.i686-linux-android" 15 | ar = "./.cargo/ar.i686-linux-android" 16 | -------------------------------------------------------------------------------- /minimint-bridge/.cargo/ld.aarch64-linux-android: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec "$LD_aarch64_linux_android" $LDFLAGS_aarch64_linux_android "$@" 4 | -------------------------------------------------------------------------------- /minimint-bridge/.cargo/ld.armv7-linux-androideabi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec "$LD_armv7_linux_androideabi" $LDFLAGS_armv7_linux_androideabi "$@" 4 | -------------------------------------------------------------------------------- /minimint-bridge/.cargo/ld.i686-linux-android: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec "$LD_i686_linux_android" $LDFLAGS_i686_linux_android "$@" 4 | -------------------------------------------------------------------------------- /minimint-bridge/.cargo/ld.x86_64-linux-android: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | exec "$LD_x86_64_linux_android" $LDFLAGS_x86_64_linux_android "$@" 4 | -------------------------------------------------------------------------------- /minimint-bridge/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | -------------------------------------------------------------------------------- /minimint-bridge/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "minimint-bridge" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | [lib] 8 | crate-type = ["staticlib", "cdylib", "rlib"] 9 | 10 | [dependencies] 11 | anyhow = "1" 12 | futures = "0.3" 13 | 14 | mint-client = { git = "https://github.com/justinmoon/fedimint", branch = "aussie" } 15 | fedimint-api = { git = "https://github.com/justinmoon/fedimint", branch = "aussie" } 16 | fedimint-core = { git = "https://github.com/justinmoon/fedimint", branch = "aussie" } 17 | fedimint-sled = { git = "https://github.com/justinmoon/fedimint", branch = "aussie" } 18 | # mint-client = { path = "../../fedimint/client/client-lib/"} 19 | # fedimint-api = { path = "../../fedimint/fedimint-api/" } 20 | # fedimint-core = { path = "../../fedimint/fedimint-core/" } 21 | # fedimint-sled = { path = "../../fedimint/fedimint-sled/" } 22 | 23 | serde = { version = "1.0.142", features = [ "derive" ] } 24 | serde_json = "1.0.79" 25 | rand = { version = "0.8.5" } 26 | bitcoin = "0.29.1" 27 | lazy_static = "1.4.0" 28 | lightning-invoice = "0.20.0" 29 | tracing = "0.1.26" 30 | 31 | tracing-subscriber = { version = "0.3.1", features = [ "env-filter" ] } 32 | flutter_rust_bridge = "1" 33 | sled = "0.34.6" 34 | tokio = {version = "1.0", features = ["full"]} 35 | 36 | [target.'cfg(target_os = "ios")'.dependencies] 37 | tracing-oslog = "0.1.2" 38 | 39 | [target.'cfg(target_os = "android")'.dependencies] 40 | paranoid-android = { git = "https://github.com/justinmoon/paranoid-android", branch="c_char" } 41 | 42 | [patch.crates-io] 43 | secp256k1-zkp = { git = "https://github.com/dpc/rust-secp256k1-zkp/", branch = "sanket-pr" } 44 | -------------------------------------------------------------------------------- /minimint-bridge/README.md: -------------------------------------------------------------------------------- 1 | ## Building with Nix 2 | 3 | Included `flake.nix` provides convenient reproducible building environment, 4 | including cross-compilation for Android. 5 | 6 | 7 | #### Set up Nix (one time) 8 | 9 | Fedimint uses [Nix](https://nixos.org/explore.html) for building, CI, and managing dev environment. 10 | Note: only `Nix` (the language & package manager) and not the NixOS (the Linux distribution) is needed. 11 | Nix can be installed on any Linux distribution and macOS. 12 | 13 | 14 | #### Install Nix 15 | 16 | If you don't have it set up already, 17 | follow the instructions at: https://nixos.org/download.html 18 | 19 | The end result is having a working `nix` command in your shell. 20 | 21 | Example: 22 | 23 | ``` 24 | > nix --version 25 | nix (Nix) 2.9.1 26 | ``` 27 | 28 | The exact version might be different. 29 | 30 | #### Enable nix flakes 31 | 32 | Edit either `~/.config/nix/nix.conf` or `/etc/nix/nix.conf` and add: 33 | 34 | ``` 35 | experimental-features = nix-command flakes 36 | ``` 37 | 38 | If the Nix installation is in multi-user mode, don’t forget to restart the nix-daemon. 39 | 40 | #### Use Nix Shell 41 | 42 | If your Nix is set up properly `nix develop` started inside the project dir should just work 43 | (though it might take a while to download all the necessary files and build all the internal 44 | tooling). In the meantime you can read other documentation. 45 | 46 | **Using `nix develop` is strongly recommended**. It takes care of setting up 47 | all the required developer automation, checks and ensures that all the developers and CI are 48 | in sync: working with same set of tools (exact versions). 49 | 50 | You can still use your favorite IDE, Unix shell, and other personal utilities, but they MUST NOT 51 | be expected to be a requirements for other developers. In other words: if it's not automated 52 | and set up in `nix develop` shell, it doesn't exist from team's perspective. 53 | 54 | To use a different shell for `nix develop`, try `nix develop -c zsh`. You can alias it if 55 | don't want to remember about it. That's the recommended way to use a different shell 56 | for `nix develop`. 57 | 58 | ### Building 59 | 60 | For local work in `nix develop` shell, run: 61 | 62 | ``` 63 | cargo build --target 64 | ``` 65 | 66 | where supported targets are: 67 | 68 | * `aarch64-linux-android` 69 | * `armv7-linux-androideabi` 70 | * `i686-linux-android` 71 | * `x86_64-linux-android` 72 | 73 | For CI and automated work use one of: 74 | 75 | ``` 76 | nix build .#packages.x86_64-linux.aarch64.workspaceBuild 77 | nix build .#packages.x86_64-linux.armv7.workspaceBuild 78 | nix build .#packages.x86_64-linux.i686.workspaceBuild 79 | nix build .#packages.x86_64-linux.x86_64.workspaceBuild 80 | ``` 81 | 82 | and see the result in `./result/` directory (symlink to a directory). 83 | 84 | The `x86_64-linux` is Nix host system, and migh be different on MacOS or ARM based systems, etc. 85 | 86 | **Note**: 87 | 88 | * Building on Mac might be currently broken (but fixable). 89 | * Building on ARM MacOS will be broken until Android NDK for that platform is available. 90 | * Building targeting 32-bit archs with rocksdb enabled is broken due to https://github.com/rust-rocksdb/rust-rocksdb/pull/682 91 | -------------------------------------------------------------------------------- /minimint-bridge/flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "crane": { 4 | "inputs": { 5 | "flake-compat": "flake-compat", 6 | "flake-utils": "flake-utils", 7 | "nixpkgs": [ 8 | "nixpkgs" 9 | ] 10 | }, 11 | "locked": { 12 | "lastModified": 1663880587, 13 | "narHash": "sha256-ukehwGwR85QQpwfYIc57l8cvp0XkzriTqT4lRDUTXHU=", 14 | "owner": "dpc", 15 | "repo": "crane", 16 | "rev": "570101edb55c9ff397320c189456e8efce167220", 17 | "type": "github" 18 | }, 19 | "original": { 20 | "owner": "dpc", 21 | "repo": "crane", 22 | "type": "github" 23 | } 24 | }, 25 | "fenix": { 26 | "inputs": { 27 | "nixpkgs": [ 28 | "nixpkgs" 29 | ], 30 | "rust-analyzer-src": "rust-analyzer-src" 31 | }, 32 | "locked": { 33 | "lastModified": 1663743521, 34 | "narHash": "sha256-BTOgY0JEdA0ukfSDXO4PgPHMKenyg/KhWFeLuc5x0GQ=", 35 | "owner": "nix-community", 36 | "repo": "fenix", 37 | "rev": "f0d09e86074fae068e98e5fd7fbd9134dfbb998c", 38 | "type": "github" 39 | }, 40 | "original": { 41 | "owner": "nix-community", 42 | "repo": "fenix", 43 | "type": "github" 44 | } 45 | }, 46 | "flake-compat": { 47 | "flake": false, 48 | "locked": { 49 | "lastModified": 1650374568, 50 | "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", 51 | "owner": "edolstra", 52 | "repo": "flake-compat", 53 | "rev": "b4a34015c698c7793d592d66adbab377907a2be8", 54 | "type": "github" 55 | }, 56 | "original": { 57 | "owner": "edolstra", 58 | "repo": "flake-compat", 59 | "type": "github" 60 | } 61 | }, 62 | "flake-compat_2": { 63 | "flake": false, 64 | "locked": { 65 | "lastModified": 1650374568, 66 | "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", 67 | "owner": "edolstra", 68 | "repo": "flake-compat", 69 | "rev": "b4a34015c698c7793d592d66adbab377907a2be8", 70 | "type": "github" 71 | }, 72 | "original": { 73 | "owner": "edolstra", 74 | "repo": "flake-compat", 75 | "type": "github" 76 | } 77 | }, 78 | "flake-utils": { 79 | "locked": { 80 | "lastModified": 1659877975, 81 | "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", 82 | "owner": "numtide", 83 | "repo": "flake-utils", 84 | "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", 85 | "type": "github" 86 | }, 87 | "original": { 88 | "owner": "numtide", 89 | "repo": "flake-utils", 90 | "type": "github" 91 | } 92 | }, 93 | "flake-utils_2": { 94 | "locked": { 95 | "lastModified": 1659877975, 96 | "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", 97 | "owner": "numtide", 98 | "repo": "flake-utils", 99 | "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", 100 | "type": "github" 101 | }, 102 | "original": { 103 | "owner": "numtide", 104 | "repo": "flake-utils", 105 | "type": "github" 106 | } 107 | }, 108 | "nixpkgs": { 109 | "locked": { 110 | "lastModified": 1663661391, 111 | "narHash": "sha256-jja7QQRZQ7fH9/WhdMLwT08l62Z8vWee+e+VpFy0ikA=", 112 | "owner": "NixOS", 113 | "repo": "nixpkgs", 114 | "rev": "e64df9c5c8ffa0c9a82006e410ad630e32e6063d", 115 | "type": "github" 116 | }, 117 | "original": { 118 | "owner": "NixOS", 119 | "ref": "nixos-22.05", 120 | "repo": "nixpkgs", 121 | "type": "github" 122 | } 123 | }, 124 | "root": { 125 | "inputs": { 126 | "crane": "crane", 127 | "fenix": "fenix", 128 | "flake-compat": "flake-compat_2", 129 | "flake-utils": "flake-utils_2", 130 | "nixpkgs": "nixpkgs" 131 | } 132 | }, 133 | "rust-analyzer-src": { 134 | "flake": false, 135 | "locked": { 136 | "lastModified": 1663689031, 137 | "narHash": "sha256-ElrhxG+zwTOolSsSYtkyFK7MLZKkDi19LyQ6kExoprk=", 138 | "owner": "rust-lang", 139 | "repo": "rust-analyzer", 140 | "rev": "5b49745d009634170493a214364261e36228274b", 141 | "type": "github" 142 | }, 143 | "original": { 144 | "owner": "rust-lang", 145 | "ref": "nightly", 146 | "repo": "rust-analyzer", 147 | "type": "github" 148 | } 149 | } 150 | }, 151 | "root": "root", 152 | "version": 7 153 | } 154 | -------------------------------------------------------------------------------- /minimint-bridge/minimint-bridge.xcodeproj/xcuserdata/futurepaul.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | minimint-bridge-staticlib.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 26 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /minimint-bridge/minimint-bridge.xcodeproj/xcuserdata/justin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | minimint-bridge-staticlib.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 11 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /minimint-bridge/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod api; 2 | mod bridge_generated; /* AUTO INJECTED BY flutter_rust_bridge. This line may not be accurate, and you can change it according to your needs. */ 3 | mod client; 4 | mod payments; 5 | -------------------------------------------------------------------------------- /minimint-bridge/src/payments.rs: -------------------------------------------------------------------------------- 1 | use std::time::SystemTime; 2 | 3 | use bitcoin::hashes::sha256; 4 | use fedimint_api::{ 5 | db::DatabaseKeyPrefixConst, 6 | encoding::{Decodable, Encodable}, 7 | }; 8 | use lightning_invoice::Invoice; 9 | 10 | const DB_PREFIX_PAYMENTS: u8 = 0x51; 11 | 12 | #[derive(Clone, Debug, Encodable, Decodable)] 13 | pub struct Payment { 14 | pub invoice: Invoice, 15 | pub status: PaymentStatus, 16 | pub created_at: u64, 17 | pub direction: PaymentDirection, 18 | } 19 | 20 | #[derive(Copy, Clone, Debug, Encodable, Decodable, PartialEq)] 21 | pub enum PaymentStatus { 22 | Paid, 23 | Pending, 24 | Failed, 25 | Expired, 26 | } 27 | 28 | #[derive(Copy, Clone, Debug, Encodable, Decodable, PartialEq)] 29 | pub enum PaymentDirection { 30 | Outgoing, 31 | Incoming, 32 | } 33 | 34 | impl Payment { 35 | pub fn new(invoice: Invoice, status: PaymentStatus, direction: PaymentDirection) -> Self { 36 | Self { 37 | invoice, 38 | status, 39 | created_at: SystemTime::now() 40 | .duration_since(SystemTime::UNIX_EPOCH) 41 | .expect("couldn't get utc timestamp") // FIXME: maybe just return 0? 42 | .as_secs(), 43 | direction, 44 | } 45 | } 46 | 47 | pub fn paid(&self) -> bool { 48 | self.status == PaymentStatus::Paid 49 | } 50 | 51 | pub fn expired(&self) -> bool { 52 | self.status == PaymentStatus::Expired 53 | } 54 | 55 | pub fn incoming(&self) -> bool { 56 | self.direction == PaymentDirection::Incoming 57 | } 58 | 59 | pub fn outgoing(&self) -> bool { 60 | self.direction == PaymentDirection::Outgoing 61 | } 62 | } 63 | 64 | #[derive(Debug, Clone, Encodable, Decodable)] 65 | pub struct PaymentKey(pub sha256::Hash); 66 | 67 | impl DatabaseKeyPrefixConst for PaymentKey { 68 | const DB_PREFIX: u8 = DB_PREFIX_PAYMENTS; 69 | type Key = Self; 70 | type Value = Payment; 71 | } 72 | 73 | #[derive(Debug, Clone, Encodable, Decodable)] 74 | pub struct PaymentKeyPrefix; 75 | 76 | impl DatabaseKeyPrefixConst for PaymentKeyPrefix { 77 | const DB_PREFIX: u8 = DB_PREFIX_PAYMENTS; 78 | type Key = PaymentKey; 79 | 80 | type Value = Payment; 81 | } 82 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | // import 'package:flutter/material.dart'; 9 | // import 'package:flutter_test/flutter_test.dart'; 10 | 11 | // import 'package:fluttermint/main.dart'; 12 | 13 | void main() { 14 | // testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // // Build our app and trigger a frame. 16 | // await tester.pumpWidget(const MyApp()); 17 | 18 | // // Verify that our counter starts at 0. 19 | // expect(find.text('0'), findsOneWidget); 20 | // expect(find.text('1'), findsNothing); 21 | 22 | // // Tap the '+' icon and trigger a frame. 23 | // await tester.tap(find.byIcon(Icons.add)); 24 | // await tester.pump(); 25 | 26 | // // Verify that our counter has incremented. 27 | // expect(find.text('0'), findsNothing); 28 | // expect(find.text('1'), findsOneWidget); 29 | // }); 30 | } 31 | -------------------------------------------------------------------------------- /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(fluttermint 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 "fluttermint") 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 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | UrlLauncherWindowsRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 14 | } 15 | -------------------------------------------------------------------------------- /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 | url_launcher_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Disable Windows macros that collide with C++ standard library functions. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 25 | 26 | # Add dependency libraries and include directories. Add any application-specific 27 | # dependencies here. 28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 30 | 31 | # Run the Flutter tool portions of the build. This must not be removed. 32 | add_dependencies(${BINARY_NAME} flutter_assemble) 33 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "fluttermint" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "fluttermint" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "fluttermint.exe" "\0" 98 | VALUE "ProductName", "fluttermint" "\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"fluttermint", 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/futurepaul/fluttermint/4377fe891b43851c86b9ddeefc1909a674d6a9a5/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.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 | --------------------------------------------------------------------------------