├── .gitignore ├── .metadata ├── .vscode └── launch.json ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_production_boilerplate_riverpod │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── fonts │ ├── Nunito-Bold.ttf │ ├── Nunito-Light.ttf │ ├── Nunito-Medium.ttf │ └── Nunito-Regular.ttf ├── img │ ├── home_dark.png │ ├── home_light.png │ ├── info_dark.png │ └── info_light.png └── translations │ ├── de.json │ └── en.json ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h └── RunnerTests │ └── RunnerTests.swift ├── lib ├── config │ └── style.dart ├── cubit │ ├── bottom_nav_cubit.dart │ ├── theme_cubit.dart │ └── theme_state.dart ├── data │ ├── enums │ │ └── .gitkeep │ ├── models │ │ └── .gitkeep │ └── repository │ │ └── .gitkeep ├── main.dart └── ui │ ├── screens │ ├── first_screen.dart │ ├── second_screen.dart │ └── skeleton_screen.dart │ └── widgets │ ├── app_bar_gone.dart │ ├── bottom_nav_bar.dart │ ├── first_screen │ ├── info_card.dart │ └── theme_card.dart │ ├── header.dart │ └── second_screen │ ├── grid_item.dart │ ├── link_card.dart │ └── text_divider.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements └── RunnerTests │ └── RunnerTests.swift ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.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 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | -------------------------------------------------------------------------------- /.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 and should not be manually edited. 5 | 6 | version: 7 | revision: "5874a72aa4c779a02553007c47dacbefba2374dc" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 17 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 18 | - platform: android 19 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 20 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 21 | - platform: ios 22 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 23 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 24 | - platform: linux 25 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 26 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 27 | - platform: macos 28 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 29 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 30 | - platform: web 31 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 32 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 33 | - platform: windows 34 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 35 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 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": "flutter_production_boilerplate", 9 | "request": "launch", 10 | "type": "dart" 11 | }, 12 | { 13 | "name": "flutter_production_boilerplate (profile mode)", 14 | "request": "launch", 15 | "type": "dart", 16 | "flutterMode": "profile" 17 | }, 18 | { 19 | "name": "flutter_production_boilerplate (release mode)", 20 | "request": "launch", 21 | "type": "dart", 22 | "flutterMode": "release" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Production Boilerplate 2 | 3 | *Note: If you prefer to use Riverpod instead of BLOC you can use [flutter_production_boilerplate_riverpod](https://github.com/anfeichtinger/flutter_production_boilerplate_riverpod)* 4 | 5 | ## A flutter project containing bloc, flutter_lints, hive, easy_translations and more! 6 | 7 | This repository is the starting point for my personal projects. If you have any suggestions or 8 | improvements feel free to let me know. The project strives to implement best practices recommended 9 | by Google and other developers. These best practices include but are not limited to: 10 | 11 | - Using BLOC & Cubit for state management. 12 | - Using Flutter Lints for stricter linting rules. 13 | - Using Hive for platform independent storage that also works for web. 14 | - Project structure, const constructors, extracted widgets and many more... 15 | 16 | ## Installation 17 | 18 | This repository requires [Flutter](https://flutter.dev/docs/get-started/install) to be installed and 19 | present in your development environment. 20 | 21 | Clone the project and enter the project folder. 22 | 23 | ```sh 24 | git clone git@github.com:anfeichtinger/flutter_production_boilerplate.git 25 | cd flutter_production_boilerplate 26 | ``` 27 | 28 | You can remove the screenshots located in [assets/img/](./assets/img). 29 | 30 | Get the dependencies. 31 | 32 | ```sh 33 | flutter pub get 34 | ``` 35 | 36 | Run the app via command line or through your development environment. (optional) 37 | 38 | ```sh 39 | flutter run lib/main.dart 40 | ``` 41 | 42 | ## Pub packages 43 | 44 | This repository makes use of the following pub packages: 45 | 46 | | Package | Version | Usage | 47 | |-----------------------------------------------------------------------------|----------|-----------------------------------------------------| 48 | | [Bloc](https://pub.dev/packages/bloc) | ^8.1.4 | State management* | 49 | | [Flutter Bloc](https://pub.dev/packages/flutter_bloc) | ^8.1.6 | State management* | 50 | | [Hydrated Bloc](https://pub.dev/packages/hydrated_bloc) | ^9.1.5 | Persists Bloc state with Hive | 51 | | [Equatable](https://pub.dev/packages/equatable) | ^2.0.5 | Easily compare custom classes, used for Bloc states* | 52 | | [Flutter Lints](https://pub.dev/packages/flutter_lints) | ^4.0.0 | Stricter linting rules* | 53 | | [Flutter Displaymode](https://pub.dev/packages/flutter_displaymode) | ^0.6.0 | Support high refresh rate displays* | 54 | | [Path Provider](https://pub.dev/packages/path_provider) | ^2.1.4 | Get the save path for Hive | 55 | | [Easy Localization](https://pub.dev/packages/easy_localization) | ^3.0.7 | Makes localization easy | 56 | | [Hive](https://pub.dev/packages/hive) | ^2.2.3 | Platform independent storage. | 57 | | [Hive Flutter](https://pub.dev/packages/hive_flutter) | ^1.1.0 | Flutter plugin for hive. | 58 | | [Url Launcher](https://pub.dev/packages/url_launcher) | ^6.3.0 | Open urls in Browser | 59 | | [FluentUI Icons](https://pub.dev/packages/fluentui_system_icons) | ^1.1.255 | Microsoft's open source icon library | 60 | | [Staggered Grid view](https://pub.dev/packages/flutter_staggered_grid_view) | ^0.7.0 | Better grid views | 61 | 62 | > \* Recommended to keep regardless of your project 63 | 64 | ## Using this package as a starting point 65 | 66 | After following the installation steps you can customize your project. The screens and widgets that 67 | are inside the project can be easily replaced or removed. They are supposed to give the user a basic 68 | understanding of the relations between widgets and some good practices. The code includes some 69 | comments with documentation and examples. The examples can be found by searching for "Example:" 70 | inside the project files. 71 | 72 | ### Changing the package and app name 73 | 74 | You can follow the instructions in this [Stackoverflow issue](https://stackoverflow.com/a/51550358) or this [Flutter package](https://pub.dev/packages/change_app_package_name) . 75 | 76 | ### Theme 77 | 78 | You can customize your brand colors in the [lib/config/style.dart](./lib/config/style.dart) file. 79 | The project uses colors from [TailwindCSS](https://tailwindcss.com/docs/customizing-colors). The default theme contains comments that indicate which tailwind color is used. Feel free to replace the colors with your own or use [dynamic material 3 themes](https://github.com/material-foundation/flutter-packages/tree/main/packages/dynamic_color). 80 | 81 | ### Removing unwanted packages 82 | 83 | If a package is not listed, then removing it from [pubspec.yaml](./pubspec.yaml) as well as all 84 | imports and uses should be enough. This is required for removing every packages, the following 85 | instructions are an addition to that. 86 | 87 | #### Flutter Lints 88 | 89 | Delete the [analysis_options.yaml](./analysis_options.yaml) file. As an alternative you can modify 90 | the rules in this file or use a different package like [Lint](https://pub.dev/packages/lint). 91 | 92 | #### Easy Localization 93 | 94 | Remove the [assets/translations](./assets/translations) folder. Go 95 | to [ios/Runner/Info.plist](./ios/Runner/Info.plist) and remove the following code: 96 | 97 | ``` 98 | CFBundleLocalizations 99 | 100 | en 101 | de 102 | 103 | ``` 104 | 105 | #### Url Launcher 106 | 107 | For iOS go to [ios/Runner/Info.plist](./ios/Runner/Info.plist) and remove the following code: 108 | 109 | ``` 110 | LSApplicationQueriesSchemes 111 | 112 | https 113 | http 114 | 115 | ``` 116 | 117 | For Android you can take a look at this [Stackoverflow issue](https://stackoverflow.com/a/65082750) 118 | for more information. Go 119 | to [android/app/src/AndroidManifest.xml](./android/app/src/main/AndroidManifest.xml) and remove the 120 | following code: 121 | 122 | ``` 123 | 124 | 125 | 126 | 127 | 128 | 129 | ``` 130 | 131 | ## Screenshots 132 | 133 | #### Light Theme 134 | 135 | | Home Light | Info Light | 136 | |--------------------------------------------------------------------------------|--------------------------------------------------------------------------------| 137 | | ![Home Light](./assets/img/home_light.png "The home page with a light theme.") | ![Info Light](./assets/img/info_light.png "The info page with a light theme.") | 138 | 139 | #### Dark Theme 140 | 141 | | Home Dark German | Info Dark German | 142 | |-----------------------------------------------------------------------------|-----------------------------------------------------------------------------| 143 | | ![Home Dark](./assets/img/home_dark.png "The home page with a dark theme.") | ![Info Dark](./assets/img/info_dark.png "The info page with a dark theme.") | 144 | 145 | ## License 146 | 147 | MIT 148 | -------------------------------------------------------------------------------- /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 https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | always_specify_types: true # Uncomment to enable the `always_specify_types` rule 27 | 28 | # Uncomment the analyzer block to enable stricter type checks 29 | analyzer: 30 | language: 31 | strict-casts: true 32 | strict-inference: true 33 | strict-raw-types: true 34 | 35 | # Additional information about this file can be found at 36 | # https://dart.dev/guides/language/analysis-options 37 | -------------------------------------------------------------------------------- /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/to/reference-keystore 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | android { 9 | namespace = "com.example.flutter_production_boilerplate" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_1_8 15 | targetCompatibility = JavaVersion.VERSION_1_8 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_1_8 20 | } 21 | 22 | defaultConfig { 23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 24 | applicationId = "com.example.flutter_production_boilerplate" 25 | // You can update the following values to match your application needs. 26 | // For more information, see: https://flutter.dev/to/review-gradle-config. 27 | minSdk = flutter.minSdkVersion 28 | targetSdk = flutter.targetSdkVersion 29 | versionCode = flutter.versionCode 30 | versionName = flutter.versionName 31 | } 32 | 33 | buildTypes { 34 | release { 35 | // TODO: Add your own signing config for the release build. 36 | // Signing with the debug keys for now, so `flutter run --release` works. 37 | signingConfig = signingConfigs.debug 38 | } 39 | } 40 | } 41 | 42 | flutter { 43 | source = "../.." 44 | } 45 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/flutter_production_boilerplate_riverpod/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_production_boilerplate 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | ext.kotlin_version = '2.0.20' 2 | 3 | allprojects { 4 | repositories { 5 | google() 6 | mavenCentral() 7 | } 8 | } 9 | 10 | rootProject.buildDir = "../build" 11 | subprojects { 12 | project.buildDir = "${rootProject.buildDir}/${project.name}" 13 | } 14 | subprojects { 15 | project.evaluationDependsOn(":app") 16 | } 17 | 18 | tasks.register("clean", Delete) { 19 | delete rootProject.buildDir 20 | } -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "7.3.0" apply false 22 | id "org.jetbrains.kotlin.android" version "2.0.20" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /assets/fonts/Nunito-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/assets/fonts/Nunito-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/Nunito-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/assets/fonts/Nunito-Light.ttf -------------------------------------------------------------------------------- /assets/fonts/Nunito-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/assets/fonts/Nunito-Medium.ttf -------------------------------------------------------------------------------- /assets/fonts/Nunito-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/assets/fonts/Nunito-Regular.ttf -------------------------------------------------------------------------------- /assets/img/home_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/assets/img/home_dark.png -------------------------------------------------------------------------------- /assets/img/home_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/assets/img/home_light.png -------------------------------------------------------------------------------- /assets/img/info_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/assets/img/info_dark.png -------------------------------------------------------------------------------- /assets/img/info_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/assets/img/info_light.png -------------------------------------------------------------------------------- /assets/translations/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_name": "Flutter Production Boilerplate", 3 | "bottom_nav_first": "Start", 4 | "bottom_nav_second": "Details", 5 | "localization_title": "Übersetzung", 6 | "localization_content": "Vereinfachte Übersetzungen mit dem Paket Easy Translations.", 7 | "linting_title": "Linting", 8 | "linting_content": "Strengere Linting-Regeln mit Flutter Lints, empfohlen vom Dart-Team.", 9 | "storage_title": "Speicher", 10 | "storage_content": "Extrem schnelle, in reinem Dart geschriebene key-value Datenbank mit Hive.", 11 | "dark_mode_title": "Nachtmodus", 12 | "dark_mode_content": "Sanfter Übergang in den Nachtmodus durch die eingebaute Theming-Engine mit Material Design 3.", 13 | "state_title": "Zustand", 14 | "state_content": "Leistungsstarke Zustandsverwaltung mit BLOC & Cubit.", 15 | "display_title": "Anzeige", 16 | "display_content": "Displays mit hoher Bildwiederholrate durch Flutter Displaymode.", 17 | "language_switch_title": "Deutsche Übersetzung", 18 | "github_card_title": "GitHub Repository", 19 | "website_card_title": "Webseite", 20 | "instagram_card_title": "Instagram", 21 | "donate_card_title": "Spenden", 22 | "author_divider_title": "Erstellt von", 23 | "packages_divider_title": "Pakete", 24 | "bloc": "Bloc", 25 | "flutter_bloc": "Flutter Bloc", 26 | "hydrated_bloc": "Hydrated Bloc", 27 | "equatable": "Equatable", 28 | "lints": "Flutter Lints", 29 | "path_provider": "Path provider", 30 | "flutter_displaymode": "Displaymode", 31 | "easy_localization": "Easy localization", 32 | "hive": "Hive", 33 | "hive_flutter": "Hive Flutter", 34 | "url_launcher": "Url launcher", 35 | "fluentui_system_icons": "FluentUI Icons", 36 | "flutter_staggered_grid_view": "Staggered Grid View" 37 | } -------------------------------------------------------------------------------- /assets/translations/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_name": "Flutter Production Boilerplate", 3 | "bottom_nav_first": "Home", 4 | "bottom_nav_second": "Details", 5 | "localization_title": "Localization", 6 | "localization_content": "Simplified translations with the Easy Translations package.", 7 | "linting_title": "Linting", 8 | "linting_content": "Stricter linting rules with flutter lints recommended by the dart team.", 9 | "storage_title": "Storage", 10 | "storage_content": "Blazing fast key-value database written in pure Dart with Hive.", 11 | "dark_mode_title": "Dark Mode", 12 | "dark_mode_content": "Smooth transition to dark mode by using the inbuilt theming engine with material design 3.", 13 | "state_title": "State", 14 | "state_content": "Powerful state management using BLOC & Cubit.", 15 | "display_title": "Display", 16 | "display_content": "Support for high refresh rate displays with flutter displaymode.", 17 | "language_switch_title": "German translation", 18 | "github_card_title": "GitHub repository", 19 | "website_card_title": "Website", 20 | "instagram_card_title": "Instagram", 21 | "donate_card_title": "Donate", 22 | "author_divider_title": "Created by", 23 | "packages_divider_title": "Packages", 24 | "bloc": "Bloc", 25 | "flutter_bloc": "Flutter Bloc", 26 | "hydrated_bloc": "Hydrated Bloc", 27 | "equatable": "Equatable", 28 | "lints": "Flutter Lints", 29 | "path_provider": "Path provider", 30 | "flutter_displaymode": "Displaymode", 31 | "easy_localization": "Easy localization", 32 | "hive": "Hive", 33 | "hive_flutter": "Hive Flutter", 34 | "url_launcher": "Url launcher", 35 | "fluentui_system_icons": "FluentUI Icons", 36 | "flutter_staggered_grid_view": "Staggered Grid View" 37 | } -------------------------------------------------------------------------------- /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 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Flutter Production Boilerplate 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | flutter_production_boilerplate 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | LSApplicationQueriesSchemes 49 | 50 | https 51 | http 52 | 53 | CFBundleLocalizations 54 | 55 | en 56 | de 57 | 58 | LSApplicationQueriesSchemes 59 | 60 | sms 61 | tel 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /lib/config/style.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// This class contains all custom styles and theme information 4 | /// to be easily updated in a single place. 5 | class Style { 6 | const Style(); 7 | 8 | // ================= 9 | // | Border radius | 10 | // ================= 11 | 12 | /// Large circular radius: 24 13 | static const Radius radiusLg = Radius.circular(24); 14 | 15 | /// Medium circular radius: 12 16 | static const Radius radiusMd = Radius.circular(12); 17 | 18 | /// Small circular radius: 8 19 | static const Radius radiusSm = Radius.circular(8); 20 | 21 | // =============== 22 | // | Light Theme | 23 | // =============== 24 | 25 | /// The custom light theme of this application 26 | static final ThemeData lightTheme = 27 | ThemeData.light(useMaterial3: true).copyWith( 28 | // Light or dark mode 29 | brightness: Brightness.light, 30 | // Basic color definitions 31 | colorScheme: ColorScheme.fromSeed( 32 | // The seed sets the primary colors automatically 33 | seedColor: const Color(0xFF7c3aed), // violet-600 34 | // How the colors are calculated from the seed 35 | dynamicSchemeVariant: DynamicSchemeVariant.rainbow, 36 | onPrimary: Colors.white, 37 | secondary: const Color(0xFF7c3aed), // violet-600 38 | onSecondary: Colors.white, 39 | tertiary: const Color(0xFFdb2777), // pink-600 40 | onTertiary: Colors.white, 41 | error: const Color(0xFFdc2626), // red-600 42 | // The main background 43 | surface: const Color(0xFFF1F5F9), // slate-100 44 | // Elements like cards on the main background 45 | surfaceContainer: Colors.white, 46 | // Text on the main background 47 | onSurface: const Color(0xFF030712), // gray-950 48 | // Text on the cards 49 | onSurfaceVariant: const Color(0xFF111827), // gray-900 50 | ), 51 | // Divider 52 | dividerColor: const Color(0xFFcbd5e1), // slate-300 53 | // Used for shadows and in this project also borders of cards 54 | shadowColor: Colors.black.withOpacity(.1), 55 | // Specific text styles and fonts 56 | textTheme: ThemeData.light(useMaterial3: true).textTheme.apply( 57 | fontFamily: 'Nunito', 58 | displayColor: const Color(0xFF030712), // gray-950 59 | bodyColor: const Color(0xFF111827), // gray-900 60 | ), 61 | primaryTextTheme: ThemeData.light(useMaterial3: true).textTheme.apply( 62 | fontFamily: 'Nunito', 63 | displayColor: Colors.white, 64 | bodyColor: const Color(0xFFf9fafb), // gray-50 65 | ), 66 | // Bottom navigation theme 67 | bottomNavigationBarTheme: const BottomNavigationBarThemeData( 68 | backgroundColor: Colors.white, 69 | elevation: 2, 70 | ), 71 | // Note: If different components are used you might need to provide specific styles for them 72 | ); 73 | 74 | // =============== 75 | // | Dark Theme | 76 | // =============== 77 | 78 | /// The custom dark theme of this application 79 | static final ThemeData darkTheme = 80 | ThemeData.dark(useMaterial3: true).copyWith( 81 | // Light or dark mode 82 | brightness: Brightness.dark, 83 | // Basic color definitions 84 | colorScheme: ColorScheme.fromSeed( 85 | // Example: Overwrite the primary color 86 | seedColor: const Color(0xFFc4b5fd), // violet-400 87 | primary: const Color(0xFFc4b5fd), // violet-400 88 | onPrimary: Colors.black, 89 | secondary: const Color(0xFFa78bfa), // violet-400 90 | onSecondary: Colors.white, 91 | tertiary: const Color(0xFFf472b6), // pink-400 92 | onTertiary: Colors.white, 93 | error: const Color(0xFFef4444), // red-500 94 | // The main background 95 | surface: Colors.black, 96 | // Elements like cards on the main background 97 | surfaceContainer: const Color(0xFF18181b), // zinc-900 98 | // Text on the main background 99 | onSurface: const Color(0xFFf9fafb), // gray-50 100 | // Text on the cards 101 | onSurfaceVariant: const Color(0xFFf3f4f6), // gray-100 102 | ), 103 | // Divider 104 | dividerColor: const Color(0xFF52525b), // zinc-600 105 | // Used for shadows and in this project also borders of cards 106 | shadowColor: Colors.white.withOpacity(.1), 107 | // Specific text styles and fonts 108 | textTheme: ThemeData.dark(useMaterial3: true).textTheme.apply( 109 | fontFamily: 'Nunito', 110 | displayColor: const Color(0xFFf9fafb), // gray-50 111 | bodyColor: const Color(0xFFf3f4f6), // gray-100 112 | ), 113 | primaryTextTheme: ThemeData.dark(useMaterial3: true).textTheme.apply( 114 | fontFamily: 'Nunito', 115 | displayColor: const Color(0xFF030712), // gray-950 116 | bodyColor: const Color(0xFF111827), // gray-900 117 | ), 118 | // Bottom navigation theme 119 | bottomNavigationBarTheme: const BottomNavigationBarThemeData( 120 | backgroundColor: Color(0xFF27272a), // zinc-800, 121 | elevation: 2, 122 | ), 123 | // Note: If different components are used you might need to provide specific styles for them 124 | ); 125 | } 126 | -------------------------------------------------------------------------------- /lib/cubit/bottom_nav_cubit.dart: -------------------------------------------------------------------------------- 1 | import 'package:hydrated_bloc/hydrated_bloc.dart'; 2 | 3 | class BottomNavCubit extends HydratedCubit { 4 | BottomNavCubit() : super(0); 5 | 6 | void updateIndex(int index) => emit(index); 7 | 8 | void getFirstScreen() => emit(0); 9 | 10 | void getSecondScreen() => emit(1); 11 | 12 | @override 13 | int? fromJson(Map json) { 14 | return json['pageIndex'] as int?; 15 | } 16 | 17 | @override 18 | Map? toJson(int state) { 19 | return {'pageIndex': state}; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/cubit/theme_cubit.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:hydrated_bloc/hydrated_bloc.dart'; 4 | 5 | part 'theme_state.dart'; 6 | 7 | class ThemeCubit extends HydratedCubit { 8 | ThemeCubit() : super(const ThemeModeState()); 9 | 10 | void getTheme(ThemeModeState state) { 11 | emit(state); 12 | } 13 | 14 | @override 15 | ThemeModeState? fromJson(Map json) { 16 | switch (json['themeMode']) { 17 | case 'ThemeMode.dark': 18 | return const ThemeModeState(themeMode: ThemeMode.dark); 19 | case 'ThemeMode.light': 20 | return const ThemeModeState(themeMode: ThemeMode.light); 21 | case 'ThemeMode.system': 22 | default: 23 | return const ThemeModeState(themeMode: ThemeMode.system); 24 | } 25 | } 26 | 27 | @override 28 | Map? toJson(ThemeModeState state) { 29 | return {'themeMode': state.themeMode.toString()}; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/cubit/theme_state.dart: -------------------------------------------------------------------------------- 1 | part of 'theme_cubit.dart'; 2 | 3 | @immutable 4 | class ThemeModeState extends Equatable { 5 | const ThemeModeState({this.themeMode = ThemeMode.system}); 6 | 7 | final ThemeMode? themeMode; 8 | 9 | @override 10 | List get props => [themeMode]; 11 | } 12 | -------------------------------------------------------------------------------- /lib/data/enums/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/lib/data/enums/.gitkeep -------------------------------------------------------------------------------- /lib/data/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/lib/data/models/.gitkeep -------------------------------------------------------------------------------- /lib/data/repository/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/lib/data/repository/.gitkeep -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:easy_localization/easy_localization.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | import 'package:flutter_displaymode/flutter_displaymode.dart'; 7 | import 'package:flutter_production_boilerplate/config/style.dart'; 8 | import 'package:hive/hive.dart'; 9 | import 'package:hydrated_bloc/hydrated_bloc.dart'; 10 | import 'package:path_provider/path_provider.dart'; 11 | 12 | import 'cubit/theme_cubit.dart'; 13 | import 'ui/screens/skeleton_screen.dart'; 14 | 15 | /// Try using const constructors as much as possible! 16 | 17 | void main() async { 18 | /// Initialize packages 19 | WidgetsFlutterBinding.ensureInitialized(); 20 | await EasyLocalization.ensureInitialized(); 21 | if (Platform.isAndroid) { 22 | await FlutterDisplayMode.setHighRefreshRate(); 23 | } 24 | final Directory tmpDir = await getTemporaryDirectory(); 25 | Hive.init(tmpDir.toString()); 26 | HydratedBloc.storage = await HydratedStorage.build( 27 | storageDirectory: tmpDir, 28 | ); 29 | 30 | runApp( 31 | EasyLocalization( 32 | path: 'assets/translations', 33 | supportedLocales: const [ 34 | Locale('en'), 35 | Locale('de'), 36 | ], 37 | fallbackLocale: const Locale('en'), 38 | useFallbackTranslations: true, 39 | child: const MyApp(), 40 | ), 41 | ); 42 | } 43 | 44 | class MyApp extends StatelessWidget { 45 | const MyApp({super.key}); 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return BlocProvider( 50 | create: (BuildContext context) => ThemeCubit(), 51 | child: BlocBuilder( 52 | builder: (BuildContext context, ThemeModeState state) { 53 | return MaterialApp( 54 | /// Localization is not available for the title. 55 | title: 'Flutter Production Boilerplate', 56 | 57 | /// Theme stuff 58 | theme: Style.lightTheme, 59 | darkTheme: Style.darkTheme, 60 | themeMode: state.themeMode, 61 | 62 | /// Localization stuff 63 | localizationsDelegates: context.localizationDelegates, 64 | supportedLocales: context.supportedLocales, 65 | locale: context.locale, 66 | debugShowCheckedModeBanner: false, 67 | home: const SkeletonScreen(), 68 | ); 69 | }, 70 | ), 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/ui/screens/first_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:fluentui_system_icons/fluentui_system_icons.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 5 | 6 | import '../widgets/first_screen/info_card.dart'; 7 | import '../widgets/first_screen/theme_card.dart'; 8 | import '../widgets/header.dart'; 9 | 10 | class FirstScreen extends StatelessWidget { 11 | const FirstScreen({super.key}); 12 | 13 | static const List infoCardPattern = [true, false, false, true]; 14 | static const List> infoCards = >[ 15 | { 16 | 'title': 'localization_title', 17 | 'content': 'localization_content', 18 | 'icon': FluentIcons.local_language_24_regular, 19 | }, 20 | { 21 | 'title': 'linting_title', 22 | 'content': 'linting_content', 23 | 'icon': FluentIcons.code_24_regular, 24 | }, 25 | { 26 | 'title': 'storage_title', 27 | 'content': 'storage_content', 28 | 'icon': FluentIcons.folder_open_24_regular, 29 | }, 30 | { 31 | 'title': 'dark_mode_title', 32 | 'content': 'dark_mode_content', 33 | 'icon': FluentIcons.weather_moon_24_regular, 34 | }, 35 | { 36 | 'title': 'state_title', 37 | 'content': 'state_content', 38 | 'icon': FluentIcons.leaf_three_24_regular, 39 | }, 40 | { 41 | 'title': 'display_title', 42 | 'content': 'display_content', 43 | 'icon': FluentIcons.top_speed_24_regular, 44 | }, 45 | ]; 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return Material( 50 | color: Theme.of(context).colorScheme.surface, 51 | child: ListView( 52 | padding: const EdgeInsets.symmetric(horizontal: 16), 53 | physics: const BouncingScrollPhysics(), 54 | children: [ 55 | const Header(text: 'app_name'), 56 | 57 | Card( 58 | elevation: 0, 59 | shadowColor: Theme.of(context).colorScheme.shadow, 60 | 61 | /// Example: Many items have their own colors inside of the ThemData 62 | /// You can overwrite them in [config/style.dart]. 63 | color: Theme.of(context).colorScheme.surfaceContainer, 64 | shape: RoundedRectangleBorder( 65 | borderRadius: const BorderRadius.all(Radius.circular(12)), 66 | side: BorderSide(color: Theme.of(context).shadowColor), 67 | ), 68 | child: SwitchListTile( 69 | onChanged: (bool newValue) { 70 | /// Example: Change locale 71 | /// The initial locale is automatically determined by the library. 72 | /// Changing the locale like this will persist the selected locale. 73 | context.setLocale( 74 | newValue ? const Locale('de') : const Locale('en')); 75 | }, 76 | shape: const RoundedRectangleBorder( 77 | borderRadius: BorderRadius.all(Radius.circular(12)), 78 | ), 79 | value: context.locale == const Locale('de'), 80 | inactiveTrackColor: 81 | Theme.of(context).colorScheme.surfaceContainer, 82 | 83 | /// You can use a FittedBox to keep Text in its bounds. 84 | title: FittedBox( 85 | alignment: Alignment.centerLeft, 86 | fit: BoxFit.scaleDown, 87 | child: Row( 88 | children: [ 89 | Icon( 90 | FluentIcons.local_language_24_regular, 91 | color: Theme.of(context).colorScheme.primary, 92 | opticalSize: 24, 93 | ), 94 | const SizedBox(width: 16), 95 | Text( 96 | tr('language_switch_title'), 97 | style: Theme.of(context) 98 | .textTheme 99 | .titleMedium! 100 | .apply(fontWeightDelta: 2), 101 | ), 102 | ], 103 | ), 104 | ), 105 | ), 106 | ), 107 | 108 | /// Example: Good way to add space between items without using Paddings 109 | const SizedBox(height: 8), 110 | 111 | const Row( 112 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 113 | children: [ 114 | ThemeCard( 115 | mode: ThemeMode.system, 116 | icon: FluentIcons.dark_theme_24_regular, 117 | ), 118 | ThemeCard( 119 | mode: ThemeMode.light, 120 | icon: FluentIcons.weather_sunny_24_regular, 121 | ), 122 | ThemeCard( 123 | mode: ThemeMode.dark, 124 | icon: FluentIcons.weather_moon_24_regular, 125 | ), 126 | ]), 127 | 128 | Padding( 129 | padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8), 130 | child: Divider( 131 | color: Theme.of(context).dividerColor, 132 | ), 133 | ), 134 | 135 | /// If no complex grids are required remove the flutter_staggered_grid_view package 136 | MasonryGridView.builder( 137 | physics: const NeverScrollableScrollPhysics(), 138 | shrinkWrap: true, 139 | itemCount: infoCards.length, 140 | padding: const EdgeInsets.all(0), 141 | 142 | /// Example: Adjust based on screen size 143 | gridDelegate: SliverSimpleGridDelegateWithFixedCrossAxisCount( 144 | crossAxisCount: MediaQuery.of(context).size.width > 768 ? 3 : 2, 145 | ), 146 | mainAxisSpacing: 8, 147 | crossAxisSpacing: 8, 148 | itemBuilder: (BuildContext context, int index) => 149 | 150 | /// Example: it is good practice to put widgets in separate files. 151 | /// This way the screen files won't become too large and 152 | /// the code becomes more clear. 153 | InfoCard( 154 | title: infoCards[index]['title'] as String, 155 | content: infoCards[index]['content'] as String, 156 | icon: infoCards[index]['icon'] as IconData, 157 | isPrimaryColor: MediaQuery.of(context).size.width > 768 158 | ? index.isEven 159 | : infoCardShouldBePrimary(index)), 160 | ), 161 | 162 | const SizedBox(height: 36), 163 | ]), 164 | ); 165 | } 166 | 167 | /// This will determine which info cards should render in primary color based on the given pattern. 168 | bool infoCardShouldBePrimary(int index) { 169 | return infoCardPattern[index % infoCardPattern.length]; 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /lib/ui/screens/second_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:fluentui_system_icons/fluentui_system_icons.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 4 | 5 | import '../widgets/header.dart'; 6 | import '../widgets/second_screen/grid_item.dart'; 7 | import '../widgets/second_screen/link_card.dart'; 8 | import '../widgets/second_screen/text_divider.dart'; 9 | 10 | class SecondScreen extends StatelessWidget { 11 | const SecondScreen({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Material( 16 | color: Theme.of(context).colorScheme.surface, 17 | child: ListView( 18 | padding: const EdgeInsets.symmetric(horizontal: 16), 19 | physics: const BouncingScrollPhysics(), 20 | children: [ 21 | const Header(text: 'bottom_nav_second'), 22 | LinkCard( 23 | title: 'github_card_title', 24 | icon: FluentIcons.diversity_24_regular, 25 | url: Uri.parse( 26 | 'https://github.com/anfeichtinger/flutter_production_boilerplate'), 27 | ), 28 | const TextDivider(text: 'author_divider_title'), 29 | Center( 30 | child: Text( 31 | 'Andreas Feichtinger', 32 | style: Theme.of(context) 33 | .textTheme 34 | .titleMedium! 35 | .apply(fontWeightDelta: 2), 36 | ), 37 | ), 38 | const SizedBox(height: 8), 39 | StaggeredGrid.count( 40 | crossAxisCount: 3, 41 | crossAxisSpacing: 0, 42 | mainAxisSpacing: 0, 43 | children: [ 44 | GridItem( 45 | title: 'instagram_card_title', 46 | icon: FluentIcons.camera_switch_24_regular, 47 | url: Uri.parse('https://www.instagram.com/anfeichtinger'), 48 | ), 49 | GridItem( 50 | title: 'donate_card_title', 51 | icon: FluentIcons.heart_24_filled, 52 | iconColor: Theme.of(context).colorScheme.tertiary, 53 | url: Uri.parse( 54 | 'https://www.paypal.com/donate?hosted_button_id=EE3W7PS6AHEP8&source=url'), 55 | ), 56 | GridItem( 57 | title: 'website_card_title', 58 | icon: FluentIcons.desktop_24_regular, 59 | url: Uri.parse('https://www.feichtinger.dev'), 60 | ), 61 | ], 62 | ), 63 | const TextDivider(text: 'packages_divider_title'), 64 | StaggeredGrid.count( 65 | crossAxisCount: MediaQuery.of(context).size.width > 768 ? 3 : 2, 66 | crossAxisSpacing: 8, 67 | mainAxisSpacing: 8, 68 | children: [ 69 | GridItem( 70 | title: 'bloc', 71 | icon: FluentIcons.apps_24_regular, 72 | url: 73 | Uri.parse('https://pub.dev/packages/bloc/versions/8.1.4'), 74 | version: '8.1.4', 75 | ), 76 | GridItem( 77 | title: 'flutter_bloc', 78 | icon: FluentIcons.grid_dots_24_regular, 79 | url: Uri.parse( 80 | 'https://pub.dev/packages/flutter_bloc/versions/8.1.6'), 81 | version: '8.1.6', 82 | ), 83 | GridItem( 84 | title: 'hydrated_bloc', 85 | icon: FluentIcons.drop_24_regular, 86 | url: Uri.parse( 87 | 'https://pub.dev/packages/hydrated_bloc/versions/9.1.5'), 88 | version: '9.1.5', 89 | ), 90 | GridItem( 91 | title: 'equatable', 92 | icon: FluentIcons.branch_compare_24_regular, 93 | url: Uri.parse( 94 | 'https://pub.dev/packages/equatable/versions/2.0.5'), 95 | version: '2.0.5', 96 | ), 97 | GridItem( 98 | title: 'path_provider', 99 | icon: FluentIcons.puzzle_piece_24_regular, 100 | url: Uri.parse( 101 | 'https://pub.dev/packages/path_provider/versions/2.1.4'), 102 | version: '2.1.4', 103 | ), 104 | GridItem( 105 | title: 'flutter_displaymode', 106 | icon: FluentIcons.top_speed_24_filled, 107 | url: Uri.parse( 108 | 'https://pub.dev/packages/flutter_displaymode/versions/0.6.0'), 109 | version: '0.6.0', 110 | ), 111 | GridItem( 112 | title: 'easy_localization', 113 | icon: FluentIcons.local_language_24_regular, 114 | url: Uri.parse( 115 | 'https://pub.dev/packages/easy_localization/versions/3.0.7'), 116 | version: '3.0.7', 117 | ), 118 | GridItem( 119 | title: 'hive', 120 | icon: FluentIcons.leaf_three_24_regular, 121 | url: 122 | Uri.parse('https://pub.dev/packages/hive/versions/2.2.3'), 123 | version: '2.2.3', 124 | ), 125 | GridItem( 126 | title: 'hive_flutter', 127 | icon: FluentIcons.leaf_two_24_regular, 128 | url: Uri.parse( 129 | 'https://pub.dev/packages/hive_flutter/versions/1.1.0'), 130 | version: '1.1.0', 131 | ), 132 | GridItem( 133 | title: 'lints', 134 | icon: FluentIcons.code_24_regular, 135 | url: Uri.parse( 136 | 'https://pub.dev/packages/flutter_lints/versions/4.0.0'), 137 | version: '4.0.0', 138 | ), 139 | GridItem( 140 | title: 'url_launcher', 141 | icon: FluentIcons.share_24_regular, 142 | url: Uri.parse( 143 | 'https://pub.dev/packages/url_launcher/versions/6.3.0'), 144 | version: '6.3.0', 145 | ), 146 | GridItem( 147 | title: 'fluentui_system_icons', 148 | icon: FluentIcons.icons_24_regular, 149 | url: Uri.parse( 150 | 'https://pub.dev/packages/fluentui_system_icons/versions/1.1.255'), 151 | version: '1.1.255', 152 | ), 153 | GridItem( 154 | title: 'flutter_staggered_grid_view', 155 | icon: FluentIcons.grid_28_regular, 156 | url: Uri.parse( 157 | 'https://pub.dev/packages/flutter_staggered_grid_view/versions/0.7.0'), 158 | version: '0.7.0', 159 | ), 160 | ], 161 | ), 162 | const SizedBox(height: 36), 163 | ]), 164 | ); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /lib/ui/screens/skeleton_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | 4 | import '../../cubit/bottom_nav_cubit.dart'; 5 | import '../widgets/app_bar_gone.dart'; 6 | import '../widgets/bottom_nav_bar.dart'; 7 | import 'first_screen.dart'; 8 | import 'second_screen.dart'; 9 | 10 | class SkeletonScreen extends StatelessWidget { 11 | const SkeletonScreen({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | const List pageNavigation = [ 16 | FirstScreen(), 17 | SecondScreen(), 18 | ]; 19 | 20 | return BlocProvider( 21 | create: (BuildContext context) => BottomNavCubit(), 22 | child: Scaffold( 23 | extendBodyBehindAppBar: true, 24 | appBar: const AppBarGone(), 25 | 26 | /// When switching between tabs this will fade the old 27 | /// layout out and the new layout in. 28 | body: BlocBuilder( 29 | builder: (BuildContext context, int state) { 30 | return AnimatedSwitcher( 31 | duration: const Duration(milliseconds: 300), 32 | child: pageNavigation.elementAt(state), 33 | ); 34 | }, 35 | ), 36 | 37 | bottomNavigationBar: const BottomNavBar(), 38 | backgroundColor: Theme.of(context).colorScheme.surface, 39 | )); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/ui/widgets/app_bar_gone.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | 4 | class AppBarGone extends StatelessWidget implements PreferredSizeWidget { 5 | const AppBarGone({super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | final Brightness brightness = Theme.of(context).colorScheme.brightness; 10 | 11 | /// This is a reliable way to change the status bar icons and color 12 | return AppBar( 13 | systemOverlayStyle: SystemUiOverlayStyle( 14 | statusBarBrightness: brightness, 15 | systemStatusBarContrastEnforced: false, 16 | statusBarColor: Theme.of(context).colorScheme.surface, 17 | statusBarIconBrightness: 18 | brightness == Brightness.dark ? Brightness.light : Brightness.dark, 19 | ), 20 | backgroundColor: Colors.transparent, 21 | excludeHeaderSemantics: true, 22 | shadowColor: Colors.transparent, 23 | scrolledUnderElevation: 0, 24 | surfaceTintColor: Colors.transparent, 25 | foregroundColor: Colors.transparent, 26 | elevation: 0, 27 | bottomOpacity: 0, 28 | toolbarOpacity: 0, 29 | ); 30 | } 31 | 32 | @override 33 | Size get preferredSize => const Size.fromHeight(0); 34 | } 35 | -------------------------------------------------------------------------------- /lib/ui/widgets/bottom_nav_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:fluentui_system_icons/fluentui_system_icons.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_bloc/flutter_bloc.dart'; 5 | import 'package:flutter_production_boilerplate/config/style.dart'; 6 | 7 | import '../../cubit/bottom_nav_cubit.dart'; 8 | 9 | class BottomNavBar extends StatelessWidget { 10 | /// It is okay not to use a const constructor here. 11 | /// Using const breaks updating of selected BottomNavigationBarItem. 12 | const BottomNavBar({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Card( 17 | margin: const EdgeInsets.all(0), 18 | elevation: Theme.of(context).bottomNavigationBarTheme.elevation, 19 | shadowColor: Theme.of(context).colorScheme.shadow, 20 | color: Theme.of(context).bottomNavigationBarTheme.backgroundColor, 21 | clipBehavior: Clip.antiAlias, 22 | shape: RoundedRectangleBorder( 23 | borderRadius: const BorderRadius.only( 24 | topLeft: Style.radiusLg, 25 | topRight: Style.radiusLg, 26 | ), 27 | side: BorderSide( 28 | color: Theme.of(context).shadowColor, 29 | strokeAlign: BorderSide.strokeAlignInside, 30 | ), 31 | ), 32 | child: BlocBuilder( 33 | builder: (BuildContext context, int state) { 34 | return BottomNavigationBar( 35 | currentIndex: state, 36 | onTap: (int index) => 37 | context.read().updateIndex(index), 38 | type: BottomNavigationBarType.fixed, 39 | elevation: 0, 40 | backgroundColor: Colors.transparent, 41 | items: [ 42 | BottomNavigationBarItem( 43 | icon: const Icon(FluentIcons.home_24_regular), 44 | label: tr('bottom_nav_first'), 45 | ), 46 | BottomNavigationBarItem( 47 | icon: const Icon(FluentIcons.info_24_regular), 48 | label: tr('bottom_nav_second'), 49 | ), 50 | ], 51 | ); 52 | }), 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/ui/widgets/first_screen/info_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_production_boilerplate/config/style.dart'; 4 | 5 | class InfoCard extends StatelessWidget { 6 | const InfoCard( 7 | {super.key, 8 | required this.title, 9 | required this.content, 10 | required this.icon, 11 | required this.isPrimaryColor}); 12 | 13 | final String title; 14 | final String content; 15 | final IconData icon; 16 | final bool isPrimaryColor; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | final TextTheme textTheme = isPrimaryColor 21 | ? Theme.of(context).primaryTextTheme 22 | : Theme.of(context).textTheme; 23 | 24 | return Card( 25 | elevation: 0, 26 | shadowColor: Theme.of(context).colorScheme.shadow, 27 | color: isPrimaryColor 28 | ? Theme.of(context).colorScheme.primary 29 | : Theme.of(context).colorScheme.surfaceContainer, 30 | shape: RoundedRectangleBorder( 31 | borderRadius: const BorderRadius.all(Style.radiusMd), 32 | side: BorderSide(color: Theme.of(context).shadowColor), 33 | ), 34 | child: Padding( 35 | padding: const EdgeInsets.all(12.0), 36 | child: Column( 37 | mainAxisSize: MainAxisSize.min, 38 | crossAxisAlignment: CrossAxisAlignment.start, 39 | children: [ 40 | SizedBox( 41 | height: 28, 42 | child: FittedBox( 43 | fit: BoxFit.fitWidth, 44 | child: Text( 45 | tr(title), 46 | style: textTheme.displayMedium, 47 | ), 48 | ), 49 | ), 50 | const SizedBox(height: 8), 51 | Text( 52 | tr(content), 53 | style: textTheme.bodyMedium, 54 | ), 55 | const SizedBox(height: 24), 56 | Icon( 57 | icon, 58 | size: 36, 59 | color: textTheme.bodyMedium!.color, 60 | ), 61 | ], 62 | ), 63 | ), 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/ui/widgets/first_screen/theme_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:flutter_production_boilerplate/config/style.dart'; 4 | 5 | import '../../../cubit/theme_cubit.dart'; 6 | 7 | class ThemeCard extends StatelessWidget { 8 | const ThemeCard({ 9 | super.key, 10 | required this.mode, 11 | required this.icon, 12 | }); 13 | 14 | final IconData icon; 15 | final ThemeMode mode; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return BlocBuilder( 20 | builder: (BuildContext context, ThemeModeState state) { 21 | return Expanded( 22 | child: Card( 23 | elevation: 0, 24 | shadowColor: Theme.of(context).colorScheme.shadow, 25 | color: state.themeMode == mode 26 | ? Theme.of(context).colorScheme.primary 27 | : Theme.of(context).colorScheme.surfaceContainer, 28 | shape: RoundedRectangleBorder( 29 | borderRadius: const BorderRadius.all(Style.radiusMd), 30 | side: BorderSide(color: Theme.of(context).shadowColor), 31 | ), 32 | child: SizedBox( 33 | height: 52, 34 | child: InkWell( 35 | onTap: () => BlocProvider.of(context).getTheme( 36 | ThemeModeState(themeMode: mode), 37 | ), 38 | borderRadius: const BorderRadius.all(Style.radiusMd), 39 | child: Icon( 40 | icon, 41 | size: 32, 42 | color: state.themeMode != mode 43 | ? Theme.of(context).colorScheme.primary 44 | : Theme.of(context).colorScheme.onPrimary, 45 | ), 46 | ), 47 | ), 48 | ), 49 | ); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/ui/widgets/header.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class Header extends StatelessWidget { 5 | const Header({super.key, required this.text}); 6 | 7 | final String text; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Padding( 12 | padding: const EdgeInsets.only(left: 2, right: 2, top: 48, bottom: 24), 13 | child: Text( 14 | tr(text), 15 | textAlign: TextAlign.start, 16 | style: Theme.of(context) 17 | .textTheme 18 | .headlineMedium! 19 | .apply(fontWeightDelta: 2), 20 | ), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/ui/widgets/second_screen/grid_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_production_boilerplate/config/style.dart'; 4 | import 'package:url_launcher/url_launcher.dart'; 5 | 6 | class GridItem extends StatelessWidget { 7 | /// Named parameters are preferred, they make the code easier to understand. 8 | const GridItem( 9 | {super.key, 10 | required this.title, 11 | required this.icon, 12 | required this.url, 13 | this.iconColor, 14 | this.version}); 15 | 16 | final String title; 17 | final IconData icon; 18 | final Color? iconColor; 19 | final Uri url; 20 | final String? version; 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return Card( 25 | elevation: 0, 26 | shadowColor: Theme.of(context).colorScheme.shadow, 27 | color: Theme.of(context).colorScheme.surfaceContainer, 28 | shape: RoundedRectangleBorder( 29 | borderRadius: const BorderRadius.all(Style.radiusMd), 30 | side: BorderSide(color: Theme.of(context).shadowColor), 31 | ), 32 | child: ListTile( 33 | onTap: _launchUrl, 34 | shape: const RoundedRectangleBorder( 35 | borderRadius: BorderRadius.all(Style.radiusMd), 36 | ), 37 | contentPadding: const EdgeInsets.all(0), 38 | title: Column( 39 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 40 | children: [ 41 | Icon( 42 | icon, 43 | color: iconColor ?? Theme.of(context).colorScheme.primary, 44 | size: 28, 45 | ), 46 | const SizedBox(height: 4), 47 | Text( 48 | tr(title), 49 | textAlign: TextAlign.center, 50 | style: Theme.of(context).textTheme.bodyMedium!, 51 | ), 52 | if (version != null) 53 | Column( 54 | children: [ 55 | const SizedBox(height: 4), 56 | Padding( 57 | padding: const EdgeInsets.only(bottom: 6), 58 | child: Text( 59 | version!, 60 | style: Theme.of(context).textTheme.labelMedium, 61 | ), 62 | ), 63 | ], 64 | ) 65 | else 66 | const SizedBox(), 67 | ], 68 | ), 69 | ), 70 | ); 71 | } 72 | 73 | /// Example: Use the url_launcher package to open the browser 74 | Future _launchUrl() async => await canLaunchUrl(url) 75 | ? await launchUrl(url) 76 | : throw Exception('Could not launch $url'); 77 | } 78 | -------------------------------------------------------------------------------- /lib/ui/widgets/second_screen/link_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:fluentui_system_icons/fluentui_system_icons.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_production_boilerplate/config/style.dart'; 5 | 6 | import 'package:url_launcher/url_launcher.dart'; 7 | 8 | class LinkCard extends StatelessWidget { 9 | const LinkCard( 10 | {super.key, required this.title, required this.icon, required this.url}); 11 | 12 | final String title; 13 | final IconData icon; 14 | final Uri url; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Card( 19 | elevation: 0, 20 | shadowColor: Theme.of(context).colorScheme.shadow, 21 | color: Theme.of(context).colorScheme.surfaceContainer, 22 | shape: RoundedRectangleBorder( 23 | borderRadius: const BorderRadius.all(Style.radiusMd), 24 | side: BorderSide(color: Theme.of(context).shadowColor), 25 | ), 26 | child: ListTile( 27 | onTap: _launchUrl, 28 | shape: const RoundedRectangleBorder( 29 | borderRadius: BorderRadius.all(Style.radiusMd), 30 | ), 31 | trailing: Icon( 32 | FluentIcons.open_24_regular, 33 | color: Theme.of(context).textTheme.titleMedium!.color, 34 | ), 35 | title: FittedBox( 36 | alignment: Alignment.centerLeft, 37 | fit: BoxFit.scaleDown, 38 | child: Row( 39 | mainAxisSize: MainAxisSize.max, 40 | children: [ 41 | Icon(icon, color: Theme.of(context).colorScheme.primary), 42 | const SizedBox(width: 16), 43 | Text( 44 | tr(title), 45 | style: Theme.of(context) 46 | .textTheme 47 | .titleMedium! 48 | .apply(fontWeightDelta: 2), 49 | ), 50 | ], 51 | ), 52 | ), 53 | ), 54 | ); 55 | } 56 | 57 | /// Example: Use the url_launcher package to open the browser 58 | Future _launchUrl() async => await canLaunchUrl(url) 59 | ? await launchUrl(url) 60 | : throw Exception('Could not launch $url'); 61 | } 62 | -------------------------------------------------------------------------------- /lib/ui/widgets/second_screen/text_divider.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class TextDivider extends StatelessWidget { 5 | const TextDivider({super.key, required this.text}); 6 | 7 | final String text; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Padding( 12 | padding: const EdgeInsets.only(left: 24, top: 16, right: 24, bottom: 16), 13 | child: Row(children: [ 14 | Expanded( 15 | child: Divider( 16 | color: Theme.of(context).dividerColor, 17 | ), 18 | ), 19 | Padding( 20 | padding: const EdgeInsets.symmetric(horizontal: 12), 21 | child: Text( 22 | tr(text), 23 | style: Theme.of(context).textTheme.bodyMedium, 24 | ), 25 | ), 26 | Expanded( 27 | child: Divider( 28 | color: Theme.of(context).dividerColor, 29 | ), 30 | ), 31 | ]), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "flutter_production_boilerplate") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.flutter_production_boilerplate") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | 90 | # Generated plugin build rules, which manage building the plugins and adding 91 | # them to the application. 92 | include(flutter/generated_plugins.cmake) 93 | 94 | 95 | # === Installation === 96 | # By default, "installing" just makes a relocatable bundle in the build 97 | # directory. 98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 101 | endif() 102 | 103 | # Start with a clean build bundle directory every time. 104 | install(CODE " 105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 106 | " COMPONENT Runtime) 107 | 108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 110 | 111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 112 | COMPONENT Runtime) 113 | 114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 115 | COMPONENT Runtime) 116 | 117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 118 | COMPONENT Runtime) 119 | 120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 121 | install(FILES "${bundled_library}" 122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 123 | COMPONENT Runtime) 124 | endforeach(bundled_library) 125 | 126 | # Copy the native assets provided by the build.dart from all packages. 127 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") 128 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 129 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 130 | COMPONENT Runtime) 131 | 132 | # Fully re-copy the assets directory on each build to avoid having stale files 133 | # from a previous install. 134 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 135 | install(CODE " 136 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 137 | " COMPONENT Runtime) 138 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 139 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 140 | 141 | # Install the AOT library on non-Debug builds only. 142 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 143 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 144 | COMPONENT Runtime) 145 | endif() 146 | -------------------------------------------------------------------------------- /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, "flutter_production_boilerplate"); 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, "flutter_production_boilerplate"); 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 GApplication::startup. 85 | static void my_application_startup(GApplication* application) { 86 | //MyApplication* self = MY_APPLICATION(object); 87 | 88 | // Perform any actions required at application startup. 89 | 90 | G_APPLICATION_CLASS(my_application_parent_class)->startup(application); 91 | } 92 | 93 | // Implements GApplication::shutdown. 94 | static void my_application_shutdown(GApplication* application) { 95 | //MyApplication* self = MY_APPLICATION(object); 96 | 97 | // Perform any actions required at application shutdown. 98 | 99 | G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); 100 | } 101 | 102 | // Implements GObject::dispose. 103 | static void my_application_dispose(GObject* object) { 104 | MyApplication* self = MY_APPLICATION(object); 105 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 106 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 107 | } 108 | 109 | static void my_application_class_init(MyApplicationClass* klass) { 110 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 111 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 112 | G_APPLICATION_CLASS(klass)->startup = my_application_startup; 113 | G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; 114 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 115 | } 116 | 117 | static void my_application_init(MyApplication* self) {} 118 | 119 | MyApplication* my_application_new() { 120 | return MY_APPLICATION(g_object_new(my_application_get_type(), 121 | "application-id", APPLICATION_ID, 122 | "flags", G_APPLICATION_NON_UNIQUE, 123 | nullptr)); 124 | } 125 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import path_provider_foundation 9 | import shared_preferences_foundation 10 | import url_launcher_macos 11 | 12 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 13 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 14 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 15 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 16 | } 17 | -------------------------------------------------------------------------------- /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 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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 = flutter_production_boilerplate 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterProductionBoilerplate 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 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/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | args: 5 | dependency: transitive 6 | description: 7 | name: args 8 | sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.5.0" 12 | async: 13 | dependency: transitive 14 | description: 15 | name: async 16 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.11.0" 20 | bloc: 21 | dependency: "direct main" 22 | description: 23 | name: bloc 24 | sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "8.1.4" 28 | boolean_selector: 29 | dependency: transitive 30 | description: 31 | name: boolean_selector 32 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "2.1.1" 36 | characters: 37 | dependency: transitive 38 | description: 39 | name: characters 40 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.3.0" 44 | clock: 45 | dependency: transitive 46 | description: 47 | name: clock 48 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.1.1" 52 | collection: 53 | dependency: transitive 54 | description: 55 | name: collection 56 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "1.18.0" 60 | crypto: 61 | dependency: transitive 62 | description: 63 | name: crypto 64 | sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "3.0.5" 68 | easy_localization: 69 | dependency: "direct main" 70 | description: 71 | name: easy_localization 72 | sha256: fa59bcdbbb911a764aa6acf96bbb6fa7a5cf8234354fc45ec1a43a0349ef0201 73 | url: "https://pub.dev" 74 | source: hosted 75 | version: "3.0.7" 76 | easy_logger: 77 | dependency: transitive 78 | description: 79 | name: easy_logger 80 | sha256: c764a6e024846f33405a2342caf91c62e357c24b02c04dbc712ef232bf30ffb7 81 | url: "https://pub.dev" 82 | source: hosted 83 | version: "0.0.2" 84 | equatable: 85 | dependency: "direct main" 86 | description: 87 | name: equatable 88 | sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 89 | url: "https://pub.dev" 90 | source: hosted 91 | version: "2.0.5" 92 | fake_async: 93 | dependency: transitive 94 | description: 95 | name: fake_async 96 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 97 | url: "https://pub.dev" 98 | source: hosted 99 | version: "1.3.1" 100 | ffi: 101 | dependency: transitive 102 | description: 103 | name: ffi 104 | sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" 105 | url: "https://pub.dev" 106 | source: hosted 107 | version: "2.1.3" 108 | file: 109 | dependency: transitive 110 | description: 111 | name: file 112 | sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" 113 | url: "https://pub.dev" 114 | source: hosted 115 | version: "7.0.0" 116 | fluentui_system_icons: 117 | dependency: "direct main" 118 | description: 119 | name: fluentui_system_icons 120 | sha256: "1c79ed0897a0f61dcb442349dc1bb0cba37b5a62b94e60e1fd1b441a28d6f5ba" 121 | url: "https://pub.dev" 122 | source: hosted 123 | version: "1.1.255" 124 | flutter: 125 | dependency: "direct main" 126 | description: flutter 127 | source: sdk 128 | version: "0.0.0" 129 | flutter_bloc: 130 | dependency: "direct main" 131 | description: 132 | name: flutter_bloc 133 | sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a 134 | url: "https://pub.dev" 135 | source: hosted 136 | version: "8.1.6" 137 | flutter_displaymode: 138 | dependency: "direct main" 139 | description: 140 | name: flutter_displaymode 141 | sha256: "42c5e9abd13d28ed74f701b60529d7f8416947e58256e6659c5550db719c57ef" 142 | url: "https://pub.dev" 143 | source: hosted 144 | version: "0.6.0" 145 | flutter_lints: 146 | dependency: "direct dev" 147 | description: 148 | name: flutter_lints 149 | sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" 150 | url: "https://pub.dev" 151 | source: hosted 152 | version: "4.0.0" 153 | flutter_localizations: 154 | dependency: transitive 155 | description: flutter 156 | source: sdk 157 | version: "0.0.0" 158 | flutter_staggered_grid_view: 159 | dependency: "direct main" 160 | description: 161 | name: flutter_staggered_grid_view 162 | sha256: "19e7abb550c96fbfeb546b23f3ff356ee7c59a019a651f8f102a4ba9b7349395" 163 | url: "https://pub.dev" 164 | source: hosted 165 | version: "0.7.0" 166 | flutter_test: 167 | dependency: "direct dev" 168 | description: flutter 169 | source: sdk 170 | version: "0.0.0" 171 | flutter_web_plugins: 172 | dependency: transitive 173 | description: flutter 174 | source: sdk 175 | version: "0.0.0" 176 | hive: 177 | dependency: "direct main" 178 | description: 179 | name: hive 180 | sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" 181 | url: "https://pub.dev" 182 | source: hosted 183 | version: "2.2.3" 184 | hive_flutter: 185 | dependency: "direct main" 186 | description: 187 | name: hive_flutter 188 | sha256: dca1da446b1d808a51689fb5d0c6c9510c0a2ba01e22805d492c73b68e33eecc 189 | url: "https://pub.dev" 190 | source: hosted 191 | version: "1.1.0" 192 | hydrated_bloc: 193 | dependency: "direct main" 194 | description: 195 | name: hydrated_bloc 196 | sha256: af35b357739fe41728df10bec03aad422cdc725a1e702e03af9d2a41ea05160c 197 | url: "https://pub.dev" 198 | source: hosted 199 | version: "9.1.5" 200 | intl: 201 | dependency: transitive 202 | description: 203 | name: intl 204 | sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf 205 | url: "https://pub.dev" 206 | source: hosted 207 | version: "0.19.0" 208 | leak_tracker: 209 | dependency: transitive 210 | description: 211 | name: leak_tracker 212 | sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" 213 | url: "https://pub.dev" 214 | source: hosted 215 | version: "10.0.5" 216 | leak_tracker_flutter_testing: 217 | dependency: transitive 218 | description: 219 | name: leak_tracker_flutter_testing 220 | sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" 221 | url: "https://pub.dev" 222 | source: hosted 223 | version: "3.0.5" 224 | leak_tracker_testing: 225 | dependency: transitive 226 | description: 227 | name: leak_tracker_testing 228 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 229 | url: "https://pub.dev" 230 | source: hosted 231 | version: "3.0.1" 232 | lints: 233 | dependency: transitive 234 | description: 235 | name: lints 236 | sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" 237 | url: "https://pub.dev" 238 | source: hosted 239 | version: "4.0.0" 240 | matcher: 241 | dependency: transitive 242 | description: 243 | name: matcher 244 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 245 | url: "https://pub.dev" 246 | source: hosted 247 | version: "0.12.16+1" 248 | material_color_utilities: 249 | dependency: transitive 250 | description: 251 | name: material_color_utilities 252 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 253 | url: "https://pub.dev" 254 | source: hosted 255 | version: "0.11.1" 256 | meta: 257 | dependency: transitive 258 | description: 259 | name: meta 260 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 261 | url: "https://pub.dev" 262 | source: hosted 263 | version: "1.15.0" 264 | nested: 265 | dependency: transitive 266 | description: 267 | name: nested 268 | sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" 269 | url: "https://pub.dev" 270 | source: hosted 271 | version: "1.0.0" 272 | path: 273 | dependency: transitive 274 | description: 275 | name: path 276 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 277 | url: "https://pub.dev" 278 | source: hosted 279 | version: "1.9.0" 280 | path_provider: 281 | dependency: "direct main" 282 | description: 283 | name: path_provider 284 | sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 285 | url: "https://pub.dev" 286 | source: hosted 287 | version: "2.1.4" 288 | path_provider_android: 289 | dependency: transitive 290 | description: 291 | name: path_provider_android 292 | sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" 293 | url: "https://pub.dev" 294 | source: hosted 295 | version: "2.2.10" 296 | path_provider_foundation: 297 | dependency: transitive 298 | description: 299 | name: path_provider_foundation 300 | sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 301 | url: "https://pub.dev" 302 | source: hosted 303 | version: "2.4.0" 304 | path_provider_linux: 305 | dependency: transitive 306 | description: 307 | name: path_provider_linux 308 | sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 309 | url: "https://pub.dev" 310 | source: hosted 311 | version: "2.2.1" 312 | path_provider_platform_interface: 313 | dependency: transitive 314 | description: 315 | name: path_provider_platform_interface 316 | sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" 317 | url: "https://pub.dev" 318 | source: hosted 319 | version: "2.1.2" 320 | path_provider_windows: 321 | dependency: transitive 322 | description: 323 | name: path_provider_windows 324 | sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 325 | url: "https://pub.dev" 326 | source: hosted 327 | version: "2.3.0" 328 | platform: 329 | dependency: transitive 330 | description: 331 | name: platform 332 | sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" 333 | url: "https://pub.dev" 334 | source: hosted 335 | version: "3.1.5" 336 | plugin_platform_interface: 337 | dependency: transitive 338 | description: 339 | name: plugin_platform_interface 340 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 341 | url: "https://pub.dev" 342 | source: hosted 343 | version: "2.1.8" 344 | provider: 345 | dependency: transitive 346 | description: 347 | name: provider 348 | sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c 349 | url: "https://pub.dev" 350 | source: hosted 351 | version: "6.1.2" 352 | shared_preferences: 353 | dependency: transitive 354 | description: 355 | name: shared_preferences 356 | sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" 357 | url: "https://pub.dev" 358 | source: hosted 359 | version: "2.3.2" 360 | shared_preferences_android: 361 | dependency: transitive 362 | description: 363 | name: shared_preferences_android 364 | sha256: "480ba4345773f56acda9abf5f50bd966f581dac5d514e5fc4a18c62976bbba7e" 365 | url: "https://pub.dev" 366 | source: hosted 367 | version: "2.3.2" 368 | shared_preferences_foundation: 369 | dependency: transitive 370 | description: 371 | name: shared_preferences_foundation 372 | sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f 373 | url: "https://pub.dev" 374 | source: hosted 375 | version: "2.5.2" 376 | shared_preferences_linux: 377 | dependency: transitive 378 | description: 379 | name: shared_preferences_linux 380 | sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" 381 | url: "https://pub.dev" 382 | source: hosted 383 | version: "2.4.1" 384 | shared_preferences_platform_interface: 385 | dependency: transitive 386 | description: 387 | name: shared_preferences_platform_interface 388 | sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" 389 | url: "https://pub.dev" 390 | source: hosted 391 | version: "2.4.1" 392 | shared_preferences_web: 393 | dependency: transitive 394 | description: 395 | name: shared_preferences_web 396 | sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e 397 | url: "https://pub.dev" 398 | source: hosted 399 | version: "2.4.2" 400 | shared_preferences_windows: 401 | dependency: transitive 402 | description: 403 | name: shared_preferences_windows 404 | sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" 405 | url: "https://pub.dev" 406 | source: hosted 407 | version: "2.4.1" 408 | sky_engine: 409 | dependency: transitive 410 | description: flutter 411 | source: sdk 412 | version: "0.0.99" 413 | source_span: 414 | dependency: transitive 415 | description: 416 | name: source_span 417 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 418 | url: "https://pub.dev" 419 | source: hosted 420 | version: "1.10.0" 421 | stack_trace: 422 | dependency: transitive 423 | description: 424 | name: stack_trace 425 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" 426 | url: "https://pub.dev" 427 | source: hosted 428 | version: "1.11.1" 429 | stream_channel: 430 | dependency: transitive 431 | description: 432 | name: stream_channel 433 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 434 | url: "https://pub.dev" 435 | source: hosted 436 | version: "2.1.2" 437 | string_scanner: 438 | dependency: transitive 439 | description: 440 | name: string_scanner 441 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 442 | url: "https://pub.dev" 443 | source: hosted 444 | version: "1.2.0" 445 | synchronized: 446 | dependency: transitive 447 | description: 448 | name: synchronized 449 | sha256: a824e842b8a054f91a728b783c177c1e4731f6b124f9192468457a8913371255 450 | url: "https://pub.dev" 451 | source: hosted 452 | version: "3.2.0" 453 | term_glyph: 454 | dependency: transitive 455 | description: 456 | name: term_glyph 457 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 458 | url: "https://pub.dev" 459 | source: hosted 460 | version: "1.2.1" 461 | test_api: 462 | dependency: transitive 463 | description: 464 | name: test_api 465 | sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" 466 | url: "https://pub.dev" 467 | source: hosted 468 | version: "0.7.2" 469 | typed_data: 470 | dependency: transitive 471 | description: 472 | name: typed_data 473 | sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c 474 | url: "https://pub.dev" 475 | source: hosted 476 | version: "1.3.2" 477 | url_launcher: 478 | dependency: "direct main" 479 | description: 480 | name: url_launcher 481 | sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" 482 | url: "https://pub.dev" 483 | source: hosted 484 | version: "6.3.0" 485 | url_launcher_android: 486 | dependency: transitive 487 | description: 488 | name: url_launcher_android 489 | sha256: e35a698ac302dd68e41f73250bd9517fe3ab5fa4f18fe4647a0872db61bacbab 490 | url: "https://pub.dev" 491 | source: hosted 492 | version: "6.3.10" 493 | url_launcher_ios: 494 | dependency: transitive 495 | description: 496 | name: url_launcher_ios 497 | sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e 498 | url: "https://pub.dev" 499 | source: hosted 500 | version: "6.3.1" 501 | url_launcher_linux: 502 | dependency: transitive 503 | description: 504 | name: url_launcher_linux 505 | sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af 506 | url: "https://pub.dev" 507 | source: hosted 508 | version: "3.2.0" 509 | url_launcher_macos: 510 | dependency: transitive 511 | description: 512 | name: url_launcher_macos 513 | sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" 514 | url: "https://pub.dev" 515 | source: hosted 516 | version: "3.2.0" 517 | url_launcher_platform_interface: 518 | dependency: transitive 519 | description: 520 | name: url_launcher_platform_interface 521 | sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" 522 | url: "https://pub.dev" 523 | source: hosted 524 | version: "2.3.2" 525 | url_launcher_web: 526 | dependency: transitive 527 | description: 528 | name: url_launcher_web 529 | sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" 530 | url: "https://pub.dev" 531 | source: hosted 532 | version: "2.3.3" 533 | url_launcher_windows: 534 | dependency: transitive 535 | description: 536 | name: url_launcher_windows 537 | sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" 538 | url: "https://pub.dev" 539 | source: hosted 540 | version: "3.1.2" 541 | vector_math: 542 | dependency: transitive 543 | description: 544 | name: vector_math 545 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 546 | url: "https://pub.dev" 547 | source: hosted 548 | version: "2.1.4" 549 | vm_service: 550 | dependency: transitive 551 | description: 552 | name: vm_service 553 | sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" 554 | url: "https://pub.dev" 555 | source: hosted 556 | version: "14.2.5" 557 | web: 558 | dependency: transitive 559 | description: 560 | name: web 561 | sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 562 | url: "https://pub.dev" 563 | source: hosted 564 | version: "1.0.0" 565 | xdg_directories: 566 | dependency: transitive 567 | description: 568 | name: xdg_directories 569 | sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d 570 | url: "https://pub.dev" 571 | source: hosted 572 | version: "1.0.4" 573 | sdks: 574 | dart: ">=3.5.1 <4.0.0" 575 | flutter: ">=3.24.0" 576 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_production_boilerplate 2 | description: "A new Flutter project containing bloc, hive & easy localization." 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | # In Windows, build-name is used as the major, minor, and patch parts 19 | # of the product and file versions while build-number is used as the build suffix. 20 | version: 1.0.0 21 | 22 | environment: 23 | sdk: ^3.5.1 24 | 25 | # Dependencies specify other packages that your package needs in order to work. 26 | # To automatically upgrade your package dependencies to the latest versions 27 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 28 | # dependencies can be manually updated by changing the version numbers below to 29 | # the latest version available on pub.dev. To see which dependencies have newer 30 | # versions available, run `flutter pub outdated`. 31 | dependencies: 32 | flutter: 33 | sdk: flutter 34 | 35 | bloc: ^8.1.4 36 | flutter_bloc: ^8.1.6 37 | hydrated_bloc: ^9.1.5 38 | equatable: ^2.0.5 39 | flutter_displaymode: ^0.6.0 40 | path_provider: ^2.1.4 # Can be removed if not needed 41 | easy_localization: ^3.0.7 # Can be removed if not needed 42 | hive: ^2.2.3 # Can be removed if not needed 43 | hive_flutter: ^1.1.0 # Can be removed if not needed 44 | url_launcher: ^6.3.0 # Can be removed if not needed 45 | fluentui_system_icons: ^1.1.255 # Can be removed if not needed 46 | flutter_staggered_grid_view: ^0.7.0 # Can be removed if not needed 47 | 48 | dev_dependencies: 49 | flutter_test: 50 | sdk: flutter 51 | 52 | # The "flutter_lints" package below contains a set of recommended lints to 53 | # encourage good coding practices. The lint set provided by the package is 54 | # activated in the `analysis_options.yaml` file located at the root of your 55 | # package. See that file for information about deactivating specific lint 56 | # rules and activating additional ones. 57 | flutter_lints: ^4.0.0 58 | 59 | # For information on the generic Dart part of this file, see the 60 | # following page: https://dart.dev/tools/pub/pubspec 61 | 62 | # The following section is specific to Flutter packages. 63 | flutter: 64 | 65 | # The following line ensures that the Material Icons font is 66 | # included with your application, so that you can use the icons in 67 | # the material Icons class. 68 | uses-material-design: true 69 | 70 | assets: 71 | - assets/translations/ 72 | 73 | fonts: 74 | - family: Nunito 75 | fonts: 76 | - asset: assets/fonts/Nunito-Bold.ttf 77 | weight: 700 78 | - asset: assets/fonts/Nunito-Medium.ttf 79 | weight: 500 80 | - asset: assets/fonts/Nunito-Regular.ttf 81 | weight: 400 82 | - asset: assets/fonts/Nunito-Light.ttf 83 | weight: 300 84 | 85 | # To add assets to your application, add an assets section, like this: 86 | # assets: 87 | # - images/a_dot_burr.jpeg 88 | # - images/a_dot_ham.jpeg 89 | 90 | # An image asset can refer to one or more resolution-specific "variants", see 91 | # https://flutter.dev/to/resolution-aware-images 92 | 93 | # For details regarding adding assets from package dependencies, see 94 | # https://flutter.dev/to/asset-from-package 95 | 96 | # To add custom fonts to your application, add a fonts section here, 97 | # in this "flutter" section. Each entry in this list should have a 98 | # "family" key with the font family name, and a "fonts" key with a 99 | # list giving the asset and other descriptors for the font. For 100 | # example: 101 | # fonts: 102 | # - family: Schyler 103 | # fonts: 104 | # - asset: fonts/Schyler-Regular.ttf 105 | # - asset: fonts/Schyler-Italic.ttf 106 | # style: italic 107 | # - family: Trajan Pro 108 | # fonts: 109 | # - asset: fonts/TrajanPro.ttf 110 | # - asset: fonts/TrajanPro_Bold.ttf 111 | # weight: 700 112 | # 113 | # For details regarding fonts from package dependencies, 114 | # see https://flutter.dev/to/font-from-package 115 | -------------------------------------------------------------------------------- /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:flutter_production_boilerplate/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | flutter_production_boilerplate 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_production_boilerplate", 3 | "short_name": "flutter_production_boilerplate", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project containing bloc, hive & easy localization.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /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(flutter_production_boilerplate 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 "flutter_production_boilerplate") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 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 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /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 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /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 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "flutter_production_boilerplate" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "flutter_production_boilerplate" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "flutter_production_boilerplate.exe" "\0" 98 | VALUE "ProductName", "flutter_production_boilerplate" "\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 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /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.Create(L"flutter_production_boilerplate", 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/reafeichtinger/flutter_production_boilerplate/7e1d09a1ce17ddc3b7877f390d7a992c73d349b9/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 | -------------------------------------------------------------------------------- /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 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "resource.h" 7 | 8 | namespace { 9 | 10 | /// Window attribute that enables dark mode window decorations. 11 | /// 12 | /// Redefined in case the developer's machine has a Windows SDK older than 13 | /// version 10.0.22000.0. 14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute 15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE 16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 17 | #endif 18 | 19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 20 | 21 | /// Registry key for app theme preference. 22 | /// 23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing 24 | /// value indicates apps should use light mode. 25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] = 26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; 27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; 28 | 29 | // The number of Win32Window objects that currently exist. 30 | static int g_active_window_count = 0; 31 | 32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 33 | 34 | // Scale helper to convert logical scaler values to physical using passed in 35 | // scale factor 36 | int Scale(int source, double scale_factor) { 37 | return static_cast(source * scale_factor); 38 | } 39 | 40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 41 | // This API is only needed for PerMonitor V1 awareness mode. 42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 43 | HMODULE user32_module = LoadLibraryA("User32.dll"); 44 | if (!user32_module) { 45 | return; 46 | } 47 | auto enable_non_client_dpi_scaling = 48 | reinterpret_cast( 49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 50 | if (enable_non_client_dpi_scaling != nullptr) { 51 | enable_non_client_dpi_scaling(hwnd); 52 | } 53 | FreeLibrary(user32_module); 54 | } 55 | 56 | } // namespace 57 | 58 | // Manages the Win32Window's window class registration. 59 | class WindowClassRegistrar { 60 | public: 61 | ~WindowClassRegistrar() = default; 62 | 63 | // Returns the singleton registrar instance. 64 | static WindowClassRegistrar* GetInstance() { 65 | if (!instance_) { 66 | instance_ = new WindowClassRegistrar(); 67 | } 68 | return instance_; 69 | } 70 | 71 | // Returns the name of the window class, registering the class if it hasn't 72 | // previously been registered. 73 | const wchar_t* GetWindowClass(); 74 | 75 | // Unregisters the window class. Should only be called if there are no 76 | // instances of the window. 77 | void UnregisterWindowClass(); 78 | 79 | private: 80 | WindowClassRegistrar() = default; 81 | 82 | static WindowClassRegistrar* instance_; 83 | 84 | bool class_registered_ = false; 85 | }; 86 | 87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 88 | 89 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 90 | if (!class_registered_) { 91 | WNDCLASS window_class{}; 92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 93 | window_class.lpszClassName = kWindowClassName; 94 | window_class.style = CS_HREDRAW | CS_VREDRAW; 95 | window_class.cbClsExtra = 0; 96 | window_class.cbWndExtra = 0; 97 | window_class.hInstance = GetModuleHandle(nullptr); 98 | window_class.hIcon = 99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 100 | window_class.hbrBackground = 0; 101 | window_class.lpszMenuName = nullptr; 102 | window_class.lpfnWndProc = Win32Window::WndProc; 103 | RegisterClass(&window_class); 104 | class_registered_ = true; 105 | } 106 | return kWindowClassName; 107 | } 108 | 109 | void WindowClassRegistrar::UnregisterWindowClass() { 110 | UnregisterClass(kWindowClassName, nullptr); 111 | class_registered_ = false; 112 | } 113 | 114 | Win32Window::Win32Window() { 115 | ++g_active_window_count; 116 | } 117 | 118 | Win32Window::~Win32Window() { 119 | --g_active_window_count; 120 | Destroy(); 121 | } 122 | 123 | bool Win32Window::Create(const std::wstring& title, 124 | const Point& origin, 125 | const Size& size) { 126 | Destroy(); 127 | 128 | const wchar_t* window_class = 129 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 130 | 131 | const POINT target_point = {static_cast(origin.x), 132 | static_cast(origin.y)}; 133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 135 | double scale_factor = dpi / 96.0; 136 | 137 | HWND window = CreateWindow( 138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW, 139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 141 | nullptr, nullptr, GetModuleHandle(nullptr), this); 142 | 143 | if (!window) { 144 | return false; 145 | } 146 | 147 | UpdateTheme(window); 148 | 149 | return OnCreate(); 150 | } 151 | 152 | bool Win32Window::Show() { 153 | return ShowWindow(window_handle_, SW_SHOWNORMAL); 154 | } 155 | 156 | // static 157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 158 | UINT const message, 159 | WPARAM const wparam, 160 | LPARAM const lparam) noexcept { 161 | if (message == WM_NCCREATE) { 162 | auto window_struct = reinterpret_cast(lparam); 163 | SetWindowLongPtr(window, GWLP_USERDATA, 164 | reinterpret_cast(window_struct->lpCreateParams)); 165 | 166 | auto that = static_cast(window_struct->lpCreateParams); 167 | EnableFullDpiSupportIfAvailable(window); 168 | that->window_handle_ = window; 169 | } else if (Win32Window* that = GetThisFromHandle(window)) { 170 | return that->MessageHandler(window, message, wparam, lparam); 171 | } 172 | 173 | return DefWindowProc(window, message, wparam, lparam); 174 | } 175 | 176 | LRESULT 177 | Win32Window::MessageHandler(HWND hwnd, 178 | UINT const message, 179 | WPARAM const wparam, 180 | LPARAM const lparam) noexcept { 181 | switch (message) { 182 | case WM_DESTROY: 183 | window_handle_ = nullptr; 184 | Destroy(); 185 | if (quit_on_close_) { 186 | PostQuitMessage(0); 187 | } 188 | return 0; 189 | 190 | case WM_DPICHANGED: { 191 | auto newRectSize = reinterpret_cast(lparam); 192 | LONG newWidth = newRectSize->right - newRectSize->left; 193 | LONG newHeight = newRectSize->bottom - newRectSize->top; 194 | 195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 197 | 198 | return 0; 199 | } 200 | case WM_SIZE: { 201 | RECT rect = GetClientArea(); 202 | if (child_content_ != nullptr) { 203 | // Size and position the child window. 204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 205 | rect.bottom - rect.top, TRUE); 206 | } 207 | return 0; 208 | } 209 | 210 | case WM_ACTIVATE: 211 | if (child_content_ != nullptr) { 212 | SetFocus(child_content_); 213 | } 214 | return 0; 215 | 216 | case WM_DWMCOLORIZATIONCOLORCHANGED: 217 | UpdateTheme(hwnd); 218 | return 0; 219 | } 220 | 221 | return DefWindowProc(window_handle_, message, wparam, lparam); 222 | } 223 | 224 | void Win32Window::Destroy() { 225 | OnDestroy(); 226 | 227 | if (window_handle_) { 228 | DestroyWindow(window_handle_); 229 | window_handle_ = nullptr; 230 | } 231 | if (g_active_window_count == 0) { 232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 233 | } 234 | } 235 | 236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 237 | return reinterpret_cast( 238 | GetWindowLongPtr(window, GWLP_USERDATA)); 239 | } 240 | 241 | void Win32Window::SetChildContent(HWND content) { 242 | child_content_ = content; 243 | SetParent(content, window_handle_); 244 | RECT frame = GetClientArea(); 245 | 246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 247 | frame.bottom - frame.top, true); 248 | 249 | SetFocus(child_content_); 250 | } 251 | 252 | RECT Win32Window::GetClientArea() { 253 | RECT frame; 254 | GetClientRect(window_handle_, &frame); 255 | return frame; 256 | } 257 | 258 | HWND Win32Window::GetHandle() { 259 | return window_handle_; 260 | } 261 | 262 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 263 | quit_on_close_ = quit_on_close; 264 | } 265 | 266 | bool Win32Window::OnCreate() { 267 | // No-op; provided for subclasses. 268 | return true; 269 | } 270 | 271 | void Win32Window::OnDestroy() { 272 | // No-op; provided for subclasses. 273 | } 274 | 275 | void Win32Window::UpdateTheme(HWND const window) { 276 | DWORD light_mode; 277 | DWORD light_mode_size = sizeof(light_mode); 278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, 279 | kGetPreferredBrightnessRegValue, 280 | RRF_RT_REG_DWORD, nullptr, &light_mode, 281 | &light_mode_size); 282 | 283 | if (result == ERROR_SUCCESS) { 284 | BOOL enable_dark_mode = light_mode == 0; 285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, 286 | &enable_dark_mode, sizeof(enable_dark_mode)); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /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 a win32 window with |title| that is positioned and sized 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 this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------