diff --git a/.vscode/launch.json b/.vscode/launch.json
index 90c289b0..c2ed9e15 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -24,14 +24,14 @@
"SERVER_URL=https://app.pal-plugin.tech/api"
]
},
- // {
- // "name": "Dart: Run all Tests",
- // "type": "dart",
- // "request": "launch",
- // "program": "./test/",
- // "presentation": {
- // "clear": true,
- // }
- // },
+ {
+ "name": "Run all Tests",
+ "type": "dart",
+ "request": "launch",
+ "program": "./test/",
+ "presentation": {
+ "clear": true,
+ }
+ },
]
}
\ No newline at end of file
diff --git a/README.md b/README.md
index 719390f6..fa7358fc 100644
--- a/README.md
+++ b/README.md
@@ -85,7 +85,7 @@ class MyApp extends StatelessWidget {
appToken: 'REPLACE_WITH_YOUR_APP_TOKEN',
// --------------------
// YOUR APP IS HERE
- child: MaterialApp(
+ childApp: MaterialApp(
navigatorKey: _navigatorKey,
navigatorObservers: [PalNavigatorObserver.instance()],
home: YourApp(),
diff --git a/example/.vscode/launch.json b/example/.vscode/launch.json
new file mode 100644
index 00000000..035204ca
--- /dev/null
+++ b/example/.vscode/launch.json
@@ -0,0 +1,13 @@
+{
+ // Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
+ // Pointez pour afficher la description des attributs existants.
+ // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "example",
+ "request": "launch",
+ "type": "dart"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/example/android/app/src/main/kotlin/io/apparence/example/MainActivity.kt b/example/android/app/src/main/kotlin/io/apparence/example/MainActivity.kt
new file mode 100644
index 00000000..8e8edfab
--- /dev/null
+++ b/example/android/app/src/main/kotlin/io/apparence/example/MainActivity.kt
@@ -0,0 +1,6 @@
+package io.apparence.example
+
+import io.flutter.embedding.android.FlutterActivity
+
+class MainActivity: FlutterActivity() {
+}
diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 00000000..f74085f3
--- /dev/null
+++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 00000000..449a9f93
--- /dev/null
+++ b/example/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index ebbb63cd..acde3456 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -1,11 +1,9 @@
PODS:
- - application_icon (0.0.1):
- - Flutter
- Flutter (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- - package_info (0.0.1):
+ - package_info_plus (0.4.5):
- Flutter
- path_provider (0.0.1):
- Flutter
@@ -14,9 +12,8 @@ PODS:
- FMDB (>= 2.7.5)
DEPENDENCIES:
- - application_icon (from `.symlinks/plugins/application_icon/ios`)
- Flutter (from `Flutter`)
- - package_info (from `.symlinks/plugins/package_info/ios`)
+ - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
@@ -25,22 +22,19 @@ SPEC REPOS:
- FMDB
EXTERNAL SOURCES:
- application_icon:
- :path: ".symlinks/plugins/application_icon/ios"
Flutter:
:path: Flutter
- package_info:
- :path: ".symlinks/plugins/package_info/ios"
+ package_info_plus:
+ :path: ".symlinks/plugins/package_info_plus/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
SPEC CHECKSUMS:
- application_icon: 6c882fd954934784443dad48a169cadb5f326cb1
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
- package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
+ package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 6f5a9dcc..ea85f688 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -16,7 +16,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Pal(
- editorModeEnabled: true,
+ editorModeEnabled: false,
appToken: APPLICATION_TOKEN, // don't forget to give us a token (create it from the web dashboard configuration tab)
// --- your app is here --
childApp: MaterialApp(
diff --git a/example/linux/.gitignore b/example/linux/.gitignore
new file mode 100644
index 00000000..d3896c98
--- /dev/null
+++ b/example/linux/.gitignore
@@ -0,0 +1 @@
+flutter/ephemeral
diff --git a/example/linux/CMakeLists.txt b/example/linux/CMakeLists.txt
new file mode 100644
index 00000000..33ccce35
--- /dev/null
+++ b/example/linux/CMakeLists.txt
@@ -0,0 +1,106 @@
+cmake_minimum_required(VERSION 3.10)
+project(runner LANGUAGES CXX)
+
+set(BINARY_NAME "example")
+set(APPLICATION_ID "io.apparence.example")
+
+cmake_policy(SET CMP0063 NEW)
+
+set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
+
+# Configure build options.
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE
+ STRING "Flutter build mode" FORCE)
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
+ "Debug" "Profile" "Release")
+endif()
+
+# Compilation settings that should be applied to most targets.
+function(APPLY_STANDARD_SETTINGS TARGET)
+ target_compile_features(${TARGET} PUBLIC cxx_std_14)
+ target_compile_options(${TARGET} PRIVATE -Wall -Werror)
+ target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
+ target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
+endfunction()
+
+set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
+
+# Flutter library and tool build rules.
+add_subdirectory(${FLUTTER_MANAGED_DIR})
+
+# System-level dependencies.
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
+
+add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
+
+# Application build
+add_executable(${BINARY_NAME}
+ "main.cc"
+ "my_application.cc"
+ "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
+)
+apply_standard_settings(${BINARY_NAME})
+target_link_libraries(${BINARY_NAME} PRIVATE flutter)
+target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
+add_dependencies(${BINARY_NAME} flutter_assemble)
+# Only the install-generated bundle's copy of the executable will launch
+# correctly, since the resources must in the right relative locations. To avoid
+# people trying to run the unbundled copy, put it in a subdirectory instead of
+# the default top-level location.
+set_target_properties(${BINARY_NAME}
+ PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
+)
+
+# Generated plugin build rules, which manage building the plugins and adding
+# them to the application.
+include(flutter/generated_plugins.cmake)
+
+
+# === Installation ===
+# By default, "installing" just makes a relocatable bundle in the build
+# directory.
+set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
+endif()
+
+# Start with a clean build bundle directory every time.
+install(CODE "
+ file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
+ " COMPONENT Runtime)
+
+set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
+set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+
+install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
+ COMPONENT Runtime)
+
+install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
+ COMPONENT Runtime)
+
+install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
+ COMPONENT Runtime)
+
+if(PLUGIN_BUNDLED_LIBRARIES)
+ install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
+ DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
+ COMPONENT Runtime)
+endif()
+
+# Fully re-copy the assets directory on each build to avoid having stale files
+# from a previous install.
+set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
+install(CODE "
+ file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
+ " COMPONENT Runtime)
+install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
+ DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
+
+# Install the AOT library on non-Debug builds only.
+if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
+ install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
+ COMPONENT Runtime)
+endif()
diff --git a/example/linux/flutter/CMakeLists.txt b/example/linux/flutter/CMakeLists.txt
new file mode 100644
index 00000000..a1da1b9e
--- /dev/null
+++ b/example/linux/flutter/CMakeLists.txt
@@ -0,0 +1,91 @@
+cmake_minimum_required(VERSION 3.10)
+
+set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
+
+# Configuration provided via flutter tool.
+include(${EPHEMERAL_DIR}/generated_config.cmake)
+
+# TODO: Move the rest of this into files in ephemeral. See
+# https://github.com/flutter/flutter/issues/57146.
+
+# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
+# which isn't available in 3.10.
+function(list_prepend LIST_NAME PREFIX)
+ set(NEW_LIST "")
+ foreach(element ${${LIST_NAME}})
+ list(APPEND NEW_LIST "${PREFIX}${element}")
+ endforeach(element)
+ set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
+endfunction()
+
+# === Flutter Library ===
+# System-level dependencies.
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
+pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
+pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
+pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid)
+pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma)
+
+set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
+
+# Published to parent scope for install step.
+set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
+set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
+set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
+set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
+
+list(APPEND FLUTTER_LIBRARY_HEADERS
+ "fl_basic_message_channel.h"
+ "fl_binary_codec.h"
+ "fl_binary_messenger.h"
+ "fl_dart_project.h"
+ "fl_engine.h"
+ "fl_json_message_codec.h"
+ "fl_json_method_codec.h"
+ "fl_message_codec.h"
+ "fl_method_call.h"
+ "fl_method_channel.h"
+ "fl_method_codec.h"
+ "fl_method_response.h"
+ "fl_plugin_registrar.h"
+ "fl_plugin_registry.h"
+ "fl_standard_message_codec.h"
+ "fl_standard_method_codec.h"
+ "fl_string_codec.h"
+ "fl_value.h"
+ "fl_view.h"
+ "flutter_linux.h"
+)
+list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
+add_library(flutter INTERFACE)
+target_include_directories(flutter INTERFACE
+ "${EPHEMERAL_DIR}"
+)
+target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
+target_link_libraries(flutter INTERFACE
+ PkgConfig::GTK
+ PkgConfig::GLIB
+ PkgConfig::GIO
+ PkgConfig::BLKID
+ PkgConfig::LZMA
+)
+add_dependencies(flutter flutter_assemble)
+
+# === Flutter tool backend ===
+# _phony_ is a non-existent file to force this command to run every time,
+# since currently there's no way to get a full input/output list from the
+# flutter tool.
+add_custom_command(
+ OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
+ ${CMAKE_CURRENT_BINARY_DIR}/_phony_
+ COMMAND ${CMAKE_COMMAND} -E env
+ ${FLUTTER_TOOL_ENVIRONMENT}
+ "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
+ linux-x64 ${CMAKE_BUILD_TYPE}
+ VERBATIM
+)
+add_custom_target(flutter_assemble DEPENDS
+ "${FLUTTER_LIBRARY}"
+ ${FLUTTER_LIBRARY_HEADERS}
+)
diff --git a/example/linux/flutter/generated_plugin_registrant.cc b/example/linux/flutter/generated_plugin_registrant.cc
new file mode 100644
index 00000000..d38195aa
--- /dev/null
+++ b/example/linux/flutter/generated_plugin_registrant.cc
@@ -0,0 +1,9 @@
+//
+// Generated file. Do not edit.
+//
+
+#include "generated_plugin_registrant.h"
+
+
+void fl_register_plugins(FlPluginRegistry* registry) {
+}
diff --git a/example/linux/flutter/generated_plugin_registrant.h b/example/linux/flutter/generated_plugin_registrant.h
new file mode 100644
index 00000000..9bf74789
--- /dev/null
+++ b/example/linux/flutter/generated_plugin_registrant.h
@@ -0,0 +1,13 @@
+//
+// Generated file. Do not edit.
+//
+
+#ifndef GENERATED_PLUGIN_REGISTRANT_
+#define GENERATED_PLUGIN_REGISTRANT_
+
+#include
+
+// Registers Flutter plugins.
+void fl_register_plugins(FlPluginRegistry* registry);
+
+#endif // GENERATED_PLUGIN_REGISTRANT_
diff --git a/example/linux/flutter/generated_plugins.cmake b/example/linux/flutter/generated_plugins.cmake
new file mode 100644
index 00000000..51436ae8
--- /dev/null
+++ b/example/linux/flutter/generated_plugins.cmake
@@ -0,0 +1,15 @@
+#
+# Generated file, do not edit.
+#
+
+list(APPEND FLUTTER_PLUGIN_LIST
+)
+
+set(PLUGIN_BUNDLED_LIBRARIES)
+
+foreach(plugin ${FLUTTER_PLUGIN_LIST})
+ add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
+ target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
+ list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
+ list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
+endforeach(plugin)
diff --git a/example/linux/main.cc b/example/linux/main.cc
new file mode 100644
index 00000000..e7c5c543
--- /dev/null
+++ b/example/linux/main.cc
@@ -0,0 +1,6 @@
+#include "my_application.h"
+
+int main(int argc, char** argv) {
+ g_autoptr(MyApplication) app = my_application_new();
+ return g_application_run(G_APPLICATION(app), argc, argv);
+}
diff --git a/example/linux/my_application.cc b/example/linux/my_application.cc
new file mode 100644
index 00000000..543eaca7
--- /dev/null
+++ b/example/linux/my_application.cc
@@ -0,0 +1,104 @@
+#include "my_application.h"
+
+#include
+#ifdef GDK_WINDOWING_X11
+#include
+#endif
+
+#include "flutter/generated_plugin_registrant.h"
+
+struct _MyApplication {
+ GtkApplication parent_instance;
+ char** dart_entrypoint_arguments;
+};
+
+G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
+
+// Implements GApplication::activate.
+static void my_application_activate(GApplication* application) {
+ MyApplication* self = MY_APPLICATION(application);
+ GtkWindow* window =
+ GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
+
+ // Use a header bar when running in GNOME as this is the common style used
+ // by applications and is the setup most users will be using (e.g. Ubuntu
+ // desktop).
+ // If running on X and not using GNOME then just use a traditional title bar
+ // in case the window manager does more exotic layout, e.g. tiling.
+ // If running on Wayland assume the header bar will work (may need changing
+ // if future cases occur).
+ gboolean use_header_bar = TRUE;
+#ifdef GDK_WINDOWING_X11
+ GdkScreen *screen = gtk_window_get_screen(window);
+ if (GDK_IS_X11_SCREEN(screen)) {
+ const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
+ if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
+ use_header_bar = FALSE;
+ }
+ }
+#endif
+ if (use_header_bar) {
+ GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
+ gtk_widget_show(GTK_WIDGET(header_bar));
+ gtk_header_bar_set_title(header_bar, "example");
+ gtk_header_bar_set_show_close_button(header_bar, TRUE);
+ gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
+ }
+ else {
+ gtk_window_set_title(window, "example");
+ }
+
+ gtk_window_set_default_size(window, 1280, 720);
+ gtk_widget_show(GTK_WIDGET(window));
+
+ g_autoptr(FlDartProject) project = fl_dart_project_new();
+ fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
+
+ FlView* view = fl_view_new(project);
+ gtk_widget_show(GTK_WIDGET(view));
+ gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
+
+ fl_register_plugins(FL_PLUGIN_REGISTRY(view));
+
+ gtk_widget_grab_focus(GTK_WIDGET(view));
+}
+
+// Implements GApplication::local_command_line.
+static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) {
+ MyApplication* self = MY_APPLICATION(application);
+ // Strip out the first argument as it is the binary name.
+ self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
+
+ g_autoptr(GError) error = nullptr;
+ if (!g_application_register(application, nullptr, &error)) {
+ g_warning("Failed to register: %s", error->message);
+ *exit_status = 1;
+ return TRUE;
+ }
+
+ g_application_activate(application);
+ *exit_status = 0;
+
+ return TRUE;
+}
+
+// Implements GObject::dispose.
+static void my_application_dispose(GObject *object) {
+ MyApplication* self = MY_APPLICATION(object);
+ g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
+ G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
+}
+
+static void my_application_class_init(MyApplicationClass* klass) {
+ G_APPLICATION_CLASS(klass)->activate = my_application_activate;
+ G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
+ G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
+}
+
+static void my_application_init(MyApplication* self) {}
+
+MyApplication* my_application_new() {
+ return MY_APPLICATION(g_object_new(my_application_get_type(),
+ "application-id", APPLICATION_ID,
+ nullptr));
+}
diff --git a/example/linux/my_application.h b/example/linux/my_application.h
new file mode 100644
index 00000000..72271d5e
--- /dev/null
+++ b/example/linux/my_application.h
@@ -0,0 +1,18 @@
+#ifndef FLUTTER_MY_APPLICATION_H_
+#define FLUTTER_MY_APPLICATION_H_
+
+#include
+
+G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
+ GtkApplication)
+
+/**
+ * my_application_new:
+ *
+ * Creates a new Flutter-based application.
+ *
+ * Returns: a new #MyApplication.
+ */
+MyApplication* my_application_new();
+
+#endif // FLUTTER_MY_APPLICATION_H_
diff --git a/example/macos/.gitignore b/example/macos/.gitignore
new file mode 100644
index 00000000..d2fd3772
--- /dev/null
+++ b/example/macos/.gitignore
@@ -0,0 +1,6 @@
+# Flutter-related
+**/Flutter/ephemeral/
+**/Pods/
+
+# Xcode-related
+**/xcuserdata/
diff --git a/example/macos/Flutter/Flutter-Debug.xcconfig b/example/macos/Flutter/Flutter-Debug.xcconfig
new file mode 100644
index 00000000..4b81f9b2
--- /dev/null
+++ b/example/macos/Flutter/Flutter-Debug.xcconfig
@@ -0,0 +1,2 @@
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
+#include "ephemeral/Flutter-Generated.xcconfig"
diff --git a/example/macos/Flutter/Flutter-Release.xcconfig b/example/macos/Flutter/Flutter-Release.xcconfig
new file mode 100644
index 00000000..5caa9d15
--- /dev/null
+++ b/example/macos/Flutter/Flutter-Release.xcconfig
@@ -0,0 +1,2 @@
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
+#include "ephemeral/Flutter-Generated.xcconfig"
diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift
new file mode 100644
index 00000000..4672798d
--- /dev/null
+++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -0,0 +1,16 @@
+//
+// Generated file. Do not edit.
+//
+
+import FlutterMacOS
+import Foundation
+
+import package_info_plus_macos
+import path_provider_macos
+import sqflite
+
+func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
+ FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
+ PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
+ SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
+}
diff --git a/example/macos/Podfile b/example/macos/Podfile
new file mode 100644
index 00000000..dade8dfa
--- /dev/null
+++ b/example/macos/Podfile
@@ -0,0 +1,40 @@
+platform :osx, '10.11'
+
+# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
+ENV['COCOAPODS_DISABLE_STATS'] = 'true'
+
+project 'Runner', {
+ 'Debug' => :debug,
+ 'Profile' => :release,
+ 'Release' => :release,
+}
+
+def flutter_root
+ generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
+ unless File.exist?(generated_xcode_build_settings_path)
+ raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
+ end
+
+ File.foreach(generated_xcode_build_settings_path) do |line|
+ matches = line.match(/FLUTTER_ROOT\=(.*)/)
+ return matches[1].strip if matches
+ end
+ raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
+end
+
+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
+
+flutter_macos_podfile_setup
+
+target 'Runner' do
+ use_frameworks!
+ use_modular_headers!
+
+ flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
+end
+
+post_install do |installer|
+ installer.pods_project.targets.each do |target|
+ flutter_additional_macos_build_settings(target)
+ end
+end
diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock
new file mode 100644
index 00000000..0dd021c2
--- /dev/null
+++ b/example/macos/Podfile.lock
@@ -0,0 +1,43 @@
+PODS:
+ - FlutterMacOS (1.0.0)
+ - FMDB (2.7.5):
+ - FMDB/standard (= 2.7.5)
+ - FMDB/standard (2.7.5)
+ - package_info_plus_macos (0.0.1):
+ - FlutterMacOS
+ - path_provider_macos (0.0.1):
+ - FlutterMacOS
+ - sqflite (0.0.2):
+ - FlutterMacOS
+ - FMDB (>= 2.7.5)
+
+DEPENDENCIES:
+ - FlutterMacOS (from `Flutter/ephemeral`)
+ - package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`)
+ - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
+ - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
+
+SPEC REPOS:
+ trunk:
+ - FMDB
+
+EXTERNAL SOURCES:
+ FlutterMacOS:
+ :path: Flutter/ephemeral
+ package_info_plus_macos:
+ :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos
+ path_provider_macos:
+ :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
+ sqflite:
+ :path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
+
+SPEC CHECKSUMS:
+ FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
+ FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
+ package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c
+ path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b
+ sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
+
+PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
+
+COCOAPODS: 1.10.1
diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..ad6728b4
--- /dev/null
+++ b/example/macos/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,632 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 51;
+ objects = {
+
+/* Begin PBXAggregateTarget section */
+ 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */;
+ buildPhases = (
+ 33CC111E2044C6BF0003C045 /* ShellScript */,
+ );
+ dependencies = (
+ );
+ name = "Flutter Assemble";
+ productName = FLX;
+ };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+ 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
+ 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
+ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
+ 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
+ 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
+ 9F498F859A9279828D3FBE78 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CE95350ACD4E6445C318ADA /* Pods_Runner.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 33CC111A2044C6BA0003C045;
+ remoteInfo = FLX;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 33CC110E2044A8840003C045 /* Bundle Framework */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ );
+ name = "Bundle Framework";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 2CD3FFE0F91528435C4C851E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
+ 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; };
+ 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; };
+ 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; };
+ 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; };
+ 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; };
+ 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; };
+ 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; };
+ 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; };
+ 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; };
+ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; };
+ 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; };
+ 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; };
+ 6CE95350ACD4E6445C318ADA /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; };
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; };
+ B601654DBD4EEB5D84BA5DE5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
+ B9C866C279310E498ADDA59B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 33CC10EA2044A3C60003C045 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9F498F859A9279828D3FBE78 /* Pods_Runner.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 2ABB582C6CFEC18E5F1C71E8 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ 2CD3FFE0F91528435C4C851E /* Pods-Runner.debug.xcconfig */,
+ B601654DBD4EEB5D84BA5DE5 /* Pods-Runner.release.xcconfig */,
+ B9C866C279310E498ADDA59B /* Pods-Runner.profile.xcconfig */,
+ );
+ name = Pods;
+ path = Pods;
+ sourceTree = "";
+ };
+ 33BA886A226E78AF003329D5 /* Configs */ = {
+ isa = PBXGroup;
+ children = (
+ 33E5194F232828860026EE4D /* AppInfo.xcconfig */,
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */,
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
+ 333000ED22D3DE5D00554162 /* Warnings.xcconfig */,
+ );
+ path = Configs;
+ sourceTree = "";
+ };
+ 33CC10E42044A3C60003C045 = {
+ isa = PBXGroup;
+ children = (
+ 33FAB671232836740065AC1E /* Runner */,
+ 33CEB47122A05771004F2AC0 /* Flutter */,
+ 33CC10EE2044A3C60003C045 /* Products */,
+ D73912EC22F37F3D000D13A0 /* Frameworks */,
+ 2ABB582C6CFEC18E5F1C71E8 /* Pods */,
+ );
+ sourceTree = "";
+ };
+ 33CC10EE2044A3C60003C045 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 33CC10ED2044A3C60003C045 /* example.app */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 33CC11242044D66E0003C045 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 33CC10F22044A3C60003C045 /* Assets.xcassets */,
+ 33CC10F42044A3C60003C045 /* MainMenu.xib */,
+ 33CC10F72044A3C60003C045 /* Info.plist */,
+ );
+ name = Resources;
+ path = ..;
+ sourceTree = "";
+ };
+ 33CEB47122A05771004F2AC0 /* Flutter */ = {
+ isa = PBXGroup;
+ children = (
+ 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */,
+ 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
+ 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
+ 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
+ );
+ path = Flutter;
+ sourceTree = "";
+ };
+ 33FAB671232836740065AC1E /* Runner */ = {
+ isa = PBXGroup;
+ children = (
+ 33CC10F02044A3C60003C045 /* AppDelegate.swift */,
+ 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
+ 33E51913231747F40026EE4D /* DebugProfile.entitlements */,
+ 33E51914231749380026EE4D /* Release.entitlements */,
+ 33CC11242044D66E0003C045 /* Resources */,
+ 33BA886A226E78AF003329D5 /* Configs */,
+ );
+ path = Runner;
+ sourceTree = "";
+ };
+ D73912EC22F37F3D000D13A0 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 6CE95350ACD4E6445C318ADA /* Pods_Runner.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 33CC10EC2044A3C60003C045 /* Runner */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
+ buildPhases = (
+ 7A6CD897E70519F7AE6626D0 /* [CP] Check Pods Manifest.lock */,
+ 33CC10E92044A3C60003C045 /* Sources */,
+ 33CC10EA2044A3C60003C045 /* Frameworks */,
+ 33CC10EB2044A3C60003C045 /* Resources */,
+ 33CC110E2044A8840003C045 /* Bundle Framework */,
+ 3399D490228B24CF009A79C7 /* ShellScript */,
+ 51DDADD1DF5337608B81A755 /* [CP] Embed Pods Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 33CC11202044C79F0003C045 /* PBXTargetDependency */,
+ );
+ name = Runner;
+ productName = Runner;
+ productReference = 33CC10ED2044A3C60003C045 /* example.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 33CC10E52044A3C60003C045 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastSwiftUpdateCheck = 0920;
+ LastUpgradeCheck = 0930;
+ ORGANIZATIONNAME = "";
+ TargetAttributes = {
+ 33CC10EC2044A3C60003C045 = {
+ CreatedOnToolsVersion = 9.2;
+ LastSwiftMigration = 1100;
+ ProvisioningStyle = Automatic;
+ SystemCapabilities = {
+ com.apple.Sandbox = {
+ enabled = 1;
+ };
+ };
+ };
+ 33CC111A2044C6BA0003C045 = {
+ CreatedOnToolsVersion = 9.2;
+ ProvisioningStyle = Manual;
+ };
+ };
+ };
+ buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
+ compatibilityVersion = "Xcode 9.3";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 33CC10E42044A3C60003C045;
+ productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 33CC10EC2044A3C60003C045 /* Runner */,
+ 33CC111A2044C6BA0003C045 /* Flutter Assemble */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 33CC10EB2044A3C60003C045 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
+ 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3399D490228B24CF009A79C7 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
+ };
+ 33CC111E2044C6BF0003C045 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ Flutter/ephemeral/FlutterInputs.xcfilelist,
+ );
+ inputPaths = (
+ Flutter/ephemeral/tripwire,
+ );
+ outputFileListPaths = (
+ Flutter/ephemeral/FlutterOutputs.xcfilelist,
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
+ };
+ 51DDADD1DF5337608B81A755 /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+ 7A6CD897E70519F7AE6626D0 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 33CC10E92044A3C60003C045 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
+ 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
+ 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 33CC11202044C79F0003C045 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */;
+ targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 33CC10F42044A3C60003C045 /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 33CC10F52044A3C60003C045 /* Base */,
+ );
+ name = MainMenu.xib;
+ path = Runner;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 338D0CE9231458BD00FA5F75 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
+ };
+ name = Profile;
+ };
+ 338D0CEA231458BD00FA5F75 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
+ CODE_SIGN_STYLE = Automatic;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/../Frameworks",
+ );
+ PROVISIONING_PROFILE_SPECIFIER = "";
+ SWIFT_VERSION = 5.0;
+ };
+ name = Profile;
+ };
+ 338D0CEB231458BD00FA5F75 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CODE_SIGN_STYLE = Manual;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Profile;
+ };
+ 33CC10F92044A3C60003C045 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ };
+ name = Debug;
+ };
+ 33CC10FA2044A3C60003C045 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
+ };
+ name = Release;
+ };
+ 33CC10FC2044A3C60003C045 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
+ CODE_SIGN_STYLE = Automatic;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/../Frameworks",
+ );
+ PROVISIONING_PROFILE_SPECIFIER = "";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ };
+ name = Debug;
+ };
+ 33CC10FD2044A3C60003C045 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
+ CODE_SIGN_STYLE = Automatic;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/../Frameworks",
+ );
+ PROVISIONING_PROFILE_SPECIFIER = "";
+ SWIFT_VERSION = 5.0;
+ };
+ name = Release;
+ };
+ 33CC111C2044C6BA0003C045 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CODE_SIGN_STYLE = Manual;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 33CC111D2044C6BA0003C045 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CODE_SIGN_STYLE = Automatic;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 33CC10F92044A3C60003C045 /* Debug */,
+ 33CC10FA2044A3C60003C045 /* Release */,
+ 338D0CE9231458BD00FA5F75 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 33CC10FC2044A3C60003C045 /* Debug */,
+ 33CC10FD2044A3C60003C045 /* Release */,
+ 338D0CEA231458BD00FA5F75 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 33CC111C2044C6BA0003C045 /* Debug */,
+ 33CC111D2044C6BA0003C045 /* Release */,
+ 338D0CEB231458BD00FA5F75 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 33CC10E52044A3C60003C045 /* Project object */;
+}
diff --git a/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 00000000..18d98100
--- /dev/null
+++ b/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
new file mode 100644
index 00000000..ae8ff59d
--- /dev/null
+++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..21a3cc14
--- /dev/null
+++ b/example/macos/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 00000000..18d98100
--- /dev/null
+++ b/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/example/macos/Runner/AppDelegate.swift b/example/macos/Runner/AppDelegate.swift
new file mode 100644
index 00000000..d53ef643
--- /dev/null
+++ b/example/macos/Runner/AppDelegate.swift
@@ -0,0 +1,9 @@
+import Cocoa
+import FlutterMacOS
+
+@NSApplicationMain
+class AppDelegate: FlutterAppDelegate {
+ override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
+ return true
+ }
+}
diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 00000000..a2ec33f1
--- /dev/null
+++ b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,68 @@
+{
+ "images" : [
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "app_icon_16.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "app_icon_32.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "app_icon_32.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "app_icon_64.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "app_icon_128.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "app_icon_256.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "app_icon_256.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "app_icon_512.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "app_icon_512.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "app_icon_1024.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
new file mode 100644
index 00000000..3c4935a7
Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ
diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
new file mode 100644
index 00000000..ed4cc164
Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ
diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
new file mode 100644
index 00000000..483be613
Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ
diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
new file mode 100644
index 00000000..bcbf36df
Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ
diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
new file mode 100644
index 00000000..9c0a6528
Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ
diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
new file mode 100644
index 00000000..e71a7261
Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ
diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
new file mode 100644
index 00000000..8a31fe2d
Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ
diff --git a/example/macos/Runner/Base.lproj/MainMenu.xib b/example/macos/Runner/Base.lproj/MainMenu.xib
new file mode 100644
index 00000000..537341ab
--- /dev/null
+++ b/example/macos/Runner/Base.lproj/MainMenu.xib
@@ -0,0 +1,339 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/macos/Runner/Configs/AppInfo.xcconfig b/example/macos/Runner/Configs/AppInfo.xcconfig
new file mode 100644
index 00000000..c4854ec7
--- /dev/null
+++ b/example/macos/Runner/Configs/AppInfo.xcconfig
@@ -0,0 +1,14 @@
+// Application-level settings for the Runner target.
+//
+// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
+// future. If not, the values below would default to using the project name when this becomes a
+// 'flutter create' template.
+
+// The application's name. By default this is also the title of the Flutter window.
+PRODUCT_NAME = example
+
+// The application's bundle identifier
+PRODUCT_BUNDLE_IDENTIFIER = io.apparence.example
+
+// The copyright displayed in application information
+PRODUCT_COPYRIGHT = Copyright © 2021 io.apparence. All rights reserved.
diff --git a/example/macos/Runner/Configs/Debug.xcconfig b/example/macos/Runner/Configs/Debug.xcconfig
new file mode 100644
index 00000000..36b0fd94
--- /dev/null
+++ b/example/macos/Runner/Configs/Debug.xcconfig
@@ -0,0 +1,2 @@
+#include "../../Flutter/Flutter-Debug.xcconfig"
+#include "Warnings.xcconfig"
diff --git a/example/macos/Runner/Configs/Release.xcconfig b/example/macos/Runner/Configs/Release.xcconfig
new file mode 100644
index 00000000..dff4f495
--- /dev/null
+++ b/example/macos/Runner/Configs/Release.xcconfig
@@ -0,0 +1,2 @@
+#include "../../Flutter/Flutter-Release.xcconfig"
+#include "Warnings.xcconfig"
diff --git a/example/macos/Runner/Configs/Warnings.xcconfig b/example/macos/Runner/Configs/Warnings.xcconfig
new file mode 100644
index 00000000..42bcbf47
--- /dev/null
+++ b/example/macos/Runner/Configs/Warnings.xcconfig
@@ -0,0 +1,13 @@
+WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
+GCC_WARN_UNDECLARED_SELECTOR = YES
+CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
+CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
+CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
+CLANG_WARN_PRAGMA_PACK = YES
+CLANG_WARN_STRICT_PROTOTYPES = YES
+CLANG_WARN_COMMA = YES
+GCC_WARN_STRICT_SELECTOR_MATCH = YES
+CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
+CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
+GCC_WARN_SHADOW = YES
+CLANG_WARN_UNREACHABLE_CODE = YES
diff --git a/example/macos/Runner/DebugProfile.entitlements b/example/macos/Runner/DebugProfile.entitlements
new file mode 100644
index 00000000..08c3ab17
--- /dev/null
+++ b/example/macos/Runner/DebugProfile.entitlements
@@ -0,0 +1,14 @@
+
+
+
+
+ com.apple.security.app-sandbox
+
+ com.apple.security.cs.allow-jit
+
+ com.apple.security.network.server
+
+ com.apple.security.network.client
+
+
+
diff --git a/example/macos/Runner/Info.plist b/example/macos/Runner/Info.plist
new file mode 100644
index 00000000..4789daa6
--- /dev/null
+++ b/example/macos/Runner/Info.plist
@@ -0,0 +1,32 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIconFile
+
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ $(FLUTTER_BUILD_NAME)
+ CFBundleVersion
+ $(FLUTTER_BUILD_NUMBER)
+ LSMinimumSystemVersion
+ $(MACOSX_DEPLOYMENT_TARGET)
+ NSHumanReadableCopyright
+ $(PRODUCT_COPYRIGHT)
+ NSMainNibFile
+ MainMenu
+ NSPrincipalClass
+ NSApplication
+
+
diff --git a/example/macos/Runner/MainFlutterWindow.swift b/example/macos/Runner/MainFlutterWindow.swift
new file mode 100644
index 00000000..2722837e
--- /dev/null
+++ b/example/macos/Runner/MainFlutterWindow.swift
@@ -0,0 +1,15 @@
+import Cocoa
+import FlutterMacOS
+
+class MainFlutterWindow: NSWindow {
+ override func awakeFromNib() {
+ let flutterViewController = FlutterViewController.init()
+ let windowFrame = self.frame
+ self.contentViewController = flutterViewController
+ self.setFrame(windowFrame, display: true)
+
+ RegisterGeneratedPlugins(registry: flutterViewController)
+
+ super.awakeFromNib()
+ }
+}
diff --git a/example/macos/Runner/Release.entitlements b/example/macos/Runner/Release.entitlements
new file mode 100644
index 00000000..ee95ab7e
--- /dev/null
+++ b/example/macos/Runner/Release.entitlements
@@ -0,0 +1,10 @@
+
+
+
+
+ com.apple.security.app-sandbox
+
+ com.apple.security.network.client
+
+
+
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 0308daa9..cb39e4fc 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -1,27 +1,6 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
- _fe_analyzer_shared:
- dependency: transitive
- description:
- name: _fe_analyzer_shared
- url: "https://pub.dartlang.org"
- source: hosted
- version: "19.0.0"
- analyzer:
- dependency: transitive
- description:
- name: analyzer
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.3.0"
- application_icon:
- dependency: transitive
- description:
- name: application_icon
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
archive:
dependency: transitive
description:
@@ -50,20 +29,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
- build:
- dependency: transitive
- description:
- name: build
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
cached_network_image:
dependency: transitive
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
- version: "2.5.1"
+ version: "3.0.0"
characters:
dependency: transitive
description:
@@ -78,13 +50,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
- cli_util:
- dependency: transitive
- description:
- name: cli_util
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.3.0"
clock:
dependency: transitive
description:
@@ -99,13 +64,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
- convert:
- dependency: transitive
- description:
- name: convert
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.0.0"
crypto:
dependency: transitive
description:
@@ -119,21 +77,14 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.3"
- dart_style:
- dependency: transitive
- description:
- name: dart_style
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
+ version: "1.0.3"
dotted_border:
dependency: transitive
description:
name: dotted_border
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.7"
+ version: "2.0.0"
fake_async:
dependency: transitive
description:
@@ -166,14 +117,14 @@ packages:
name: flutter_blurhash
url: "https://pub.dartlang.org"
source: hosted
- version: "0.5.0"
+ version: "0.6.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.2"
+ version: "3.0.1"
flutter_colorpicker:
dependency: transitive
description:
@@ -198,13 +149,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
- glob:
+ flutter_web_plugins:
dependency: transitive
- description:
- name: glob
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.1"
+ description: flutter
+ source: sdk
+ version: "0.0.0"
google_fonts:
dependency: transitive
description:
@@ -218,7 +167,7 @@ packages:
name: hive
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.1"
+ version: "2.0.4"
hive_flutter:
dependency: transitive
description:
@@ -226,20 +175,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
- hive_generator:
- dependency: transitive
- description:
- name: hive_generator
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.1"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
- version: "0.13.1"
+ version: "0.13.3"
http_parser:
dependency: transitive
description:
@@ -261,13 +203,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
- logging:
+ js:
dependency: transitive
description:
- name: logging
+ name: js
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.1"
+ version: "0.6.3"
matcher:
dependency: transitive
description:
@@ -288,35 +230,63 @@ packages:
name: mvvm_builder
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.5"
+ version: "3.0.0-null.safety"
octo_image:
dependency: transitive
description:
name: octo_image
url: "https://pub.dartlang.org"
source: hosted
- version: "0.3.0"
- package_config:
+ version: "1.0.0+1"
+ package_info_plus:
dependency: transitive
description:
- name: package_config
+ name: package_info_plus
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
- package_info:
+ version: "1.0.1"
+ package_info_plus_linux:
dependency: transitive
description:
- name: package_info
+ name: package_info_plus_linux
url: "https://pub.dartlang.org"
source: hosted
- version: "2.0.0"
+ version: "1.0.1"
+ package_info_plus_macos:
+ dependency: transitive
+ description:
+ name: package_info_plus_macos
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.1"
+ package_info_plus_platform_interface:
+ dependency: transitive
+ description:
+ name: package_info_plus_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.1"
+ package_info_plus_web:
+ dependency: transitive
+ description:
+ name: package_info_plus_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.1"
+ package_info_plus_windows:
+ dependency: transitive
+ description:
+ name: package_info_plus_windows
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.1"
pal:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
- version: "1.0.0+1"
+ version: "2.0.0+1"
path:
dependency: transitive
description:
@@ -330,14 +300,14 @@ packages:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
- version: "0.4.1+1"
+ version: "0.5.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.4"
+ version: "0.2.1"
path_provider:
dependency: transitive
description:
@@ -408,32 +378,18 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
- pub_semver:
- dependency: transitive
- description:
- name: pub_semver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.0"
rxdart:
dependency: transitive
description:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
- version: "0.25.0"
+ version: "0.26.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
- source_gen:
- dependency: transitive
- description:
- name: source_gen
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.0"
source_span:
dependency: transitive
description:
@@ -447,14 +403,14 @@ packages:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.2+2"
+ version: "2.0.0+3"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.3+1"
+ version: "2.0.0+2"
stack_trace:
dependency: transitive
description:
@@ -482,7 +438,7 @@ packages:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
- version: "2.2.0+2"
+ version: "3.0.0"
term_glyph:
dependency: transitive
description:
@@ -518,13 +474,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
- watcher:
- dependency: transitive
- description:
- name: watcher
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.0"
win32:
dependency: transitive
description:
@@ -555,4 +504,4 @@ packages:
version: "3.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
- flutter: ">=1.26.0-17.5.pre"
+ flutter: ">=1.24.0-10.2.pre"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index c8d7376c..882e369d 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -26,10 +26,10 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
- cupertino_icons: ^0.1.3
- pal:
+ cupertino_icons: ^1.0.3
+ pal: #1.0.0+1
path: ../
- mvvm_builder: ^2.1.5
+ mvvm_builder: ^3.0.0-null.safety
intl: 0.17.0
dev_dependencies:
diff --git a/example/test/main_test.dart b/example/test/main_test.dart
deleted file mode 100644
index 2da53e41..00000000
--- a/example/test/main_test.dart
+++ /dev/null
@@ -1,92 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:pal_example/main.dart';
-
-main() {
- _before(WidgetTester tester) async {
- TestWidgetsFlutterBinding.ensureInitialized();
-
- MyApp myApp = MyApp();
- await tester.pumpWidget(myApp);
- }
-
- group('Hosted app integration', () {
- testWidgets('should be visible', (tester) async {
- await _before(tester);
-
- expect(find.byKey(ValueKey('pal_MainStack')), findsOneWidget);
-
- Finder hostedApp = find.byKey(ValueKey('hostedApp'));
- expect(hostedApp, findsOneWidget);
- await tester.ensureVisible(hostedApp);
-
- expect(find.byKey(ValueKey('demo_HomePage')), findsOneWidget);
- });
- });
-
- group('Pal integration', () {
- testWidgets('should be visible', (tester) async {
- await _before(tester);
-
- expect(find.byKey(ValueKey('pal_MainStack')), findsOneWidget);
-
- Finder palBubble = find.byKey(ValueKey('palBubbleOverlay'));
- expect(palBubble, findsOneWidget);
- await tester.ensureVisible(palBubble);
- });
-
- // FIXME: Test can't pass because a network call is called from HelpersListModalLoader
- // need to mock HelpersListModal
- // testWidgets('floating bubble should be tappable', (tester) async {
- // await before(tester);
- // await tester.pumpAndSettle();
-
- // Finder floatingBubble = find.byKey(ValueKey('palBubbleOverlay'));
- // await tester.ensureVisible(floatingBubble);
- // await tester.tap(floatingBubble);
- // await tester.pumpAndSettle();
-
- // // Helpers list modal should be visible
- // Finder palHelpersListModal = find.byKey(ValueKey('palHelpersListModal'));
- // expect(palHelpersListModal, findsOneWidget);
- // await tester.ensureVisible(palHelpersListModal);
-
- // // Hosted app should be visible
- // Finder hostedApp = find.byKey(ValueKey('hostedApp'));
- // expect(hostedApp, findsOneWidget);
- // await tester.ensureVisible(hostedApp);
-
- // // Close the modal
- // Finder closeButton = find.byKey(ValueKey('palHelpersListModalClose'));
- // expect(closeButton, findsOneWidget);
- // await tester.ensureVisible(closeButton);
- // await tester.tap(closeButton);
- // await tester.pumpAndSettle();
-
- // // Helpers modal should not be visible
- // expect(find.byKey(ValueKey('palHelpersListModal')), findsNothing);
- // });
-
- testWidgets('floating bubble should be draggable', (tester) async {
- await _before(tester);
-
- // Check if the floating bubble exist & be visible
- Finder floatingBubble = find.byKey(ValueKey('palBubbleOverlay'));
- await tester.ensureVisible(floatingBubble);
- Offset oldBubblePosition = tester.getCenter(floatingBubble);
-
- // Fling the widget to given offset
- Offset dragOffset = Offset(10.0, -40.0);
- await tester.fling(floatingBubble, dragOffset, 3);
- await tester.pumpAndSettle();
-
- // Test if the position of the bubble was modified by the offset
- Offset newBubblePosition =
- tester.getCenter(find.byKey(ValueKey('palBubbleOverlay')));
- expect(
- newBubblePosition.dx, equals(oldBubblePosition.dx + dragOffset.dx));
- expect(
- newBubblePosition.dy, equals(oldBubblePosition.dy + dragOffset.dy));
- });
- });
-}
diff --git a/example/test/ui/pages/home_test.dart b/example/test/ui/pages/home_test.dart
deleted file mode 100644
index 801aae04..00000000
--- a/example/test/ui/pages/home_test.dart
+++ /dev/null
@@ -1,67 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:pal_example/ui/pages/home/home_page.dart';
-
-main() {
- group('Home page', () {
- HomePage homePage = HomePage();
-
- before(WidgetTester tester) async {
- await tester.pumpWidget(
- MaterialApp(
- home: homePage,
- routes: {
- '/route1': (context) => Scaffold(body: Text('Welcome to route 1')),
- '/route2': (context) => Scaffold(body: Text('Welcome to route 2')),
- },
- ),
- );
- }
-
- testWidgets('should display properly', (tester) async {
- await before(tester);
- await tester.pumpAndSettle();
-
- expect(find.byKey(ValueKey('demo_HomePage')), findsOneWidget);
-
- expect(find.text('Pal demo'), findsOneWidget);
-
- expect(find.text('Trending now'), findsOneWidget);
-
- expect(find.text('Get a look here'), findsOneWidget);
-
- expect(find.text('One more'), findsOneWidget);
- expect(find.text('Second one'), findsOneWidget);
-
- expect(find.byKey(ValueKey('demo_HomePage_Cards_Truman')), findsOneWidget);
- expect(find.byKey(ValueKey('demo_HomePage_Cards_Gump')), findsOneWidget);
- expect(find.byKey(ValueKey('demo_HomePage_Cards_Joker')), findsOneWidget);
- });
-
- group('child navigation should work', () {
- testWidgets('should push to route 1', (tester) async {
- await before(tester);
- await tester.pumpAndSettle();
-
- Finder child1RouteButton = find.byKey(ValueKey('demo_HomePage_Cards_Joker'));
- await tester.ensureVisible(child1RouteButton);
- await tester.tap(child1RouteButton);
- await tester.pumpAndSettle();
-
- expect(find.text('Welcome to route 1'), findsOneWidget);
- });
-
- testWidgets('should push to route 2', (tester) async {
- await before(tester);
- await tester.pumpAndSettle();
-
- Finder child1RouteButton = find.byKey(ValueKey('demo_HomePage_Cards_Gump'));
- await tester.ensureVisible(child1RouteButton);
- await tester.tap(child1RouteButton);
- await tester.pumpAndSettle();
-
- expect(find.text('Welcome to route 2'), findsOneWidget);
- });
- });
- });
-}
diff --git a/example/test/ui/pages/route1_test.dart b/example/test/ui/pages/route1_test.dart
deleted file mode 100644
index 0cdea2f8..00000000
--- a/example/test/ui/pages/route1_test.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:pal_example/ui/pages/route1/route1_page.dart';
-
-main() {
- group('Route 1 page', () {
- Route1Page route1page = Route1Page();
-
- before(WidgetTester tester) async {
- await tester.pumpWidget(
- MaterialApp(
- home: route1page,
- routes: {
- '/route2': (context) => Scaffold(body: Text('Welcome to route 2')),
- },
- ),
- );
- }
-
- testWidgets('should display properly', (tester) async {
- await before(tester);
- await tester.pumpAndSettle();
-
- expect(find.byKey(ValueKey('Route1')), findsOneWidget);
- expect(find.text('Route 1'), findsOneWidget);
-
- expect(find.byKey(ValueKey('childRoute2Push2')), findsOneWidget);
- });
-
- testWidgets('should push to route 2', (tester) async {
- await before(tester);
- await tester.pumpAndSettle();
-
- Finder child1RouteButton = find.byKey(ValueKey('childRoute2Push2'));
- await tester.ensureVisible(child1RouteButton);
- await tester.tap(child1RouteButton);
- await tester.pumpAndSettle();
-
- expect(find.text('Welcome to route 2'), findsOneWidget);
- });
- });
-}
diff --git a/example/test/ui/pages/route2_test.dart b/example/test/ui/pages/route2_test.dart
deleted file mode 100644
index c45c0d65..00000000
--- a/example/test/ui/pages/route2_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:pal_example/ui/pages/route2/route2_page.dart';
-
-main() {
- group('Route 2 page', () {
- Route2Page route2page = Route2Page();
-
- before(WidgetTester tester) async {
- await tester.pumpWidget(
- MaterialApp(
- home: route2page,
- ),
- );
- }
-
- testWidgets('should display properly', (tester) async {
- await before(tester);
- await tester.pumpAndSettle();
-
- expect(find.byKey(ValueKey('Route2')), findsOneWidget);
- expect(find.text('Route 2'), findsOneWidget);
-
- expect(find.byKey(ValueKey('childRoutePop')), findsOneWidget);
- });
- });
-}
diff --git a/example/test/ui/widgets/.gitkeep b/example/test/ui/widgets/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/example/web/favicon.png b/example/web/favicon.png
new file mode 100644
index 00000000..8aaa46ac
Binary files /dev/null and b/example/web/favicon.png differ
diff --git a/example/web/icons/Icon-192.png b/example/web/icons/Icon-192.png
new file mode 100644
index 00000000..b749bfef
Binary files /dev/null and b/example/web/icons/Icon-192.png differ
diff --git a/example/web/icons/Icon-512.png b/example/web/icons/Icon-512.png
new file mode 100644
index 00000000..88cfd48d
Binary files /dev/null and b/example/web/icons/Icon-512.png differ
diff --git a/example/web/index.html b/example/web/index.html
new file mode 100644
index 00000000..1460b5e9
--- /dev/null
+++ b/example/web/index.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ example
+
+
+
+
+
+
+
+
diff --git a/example/web/manifest.json b/example/web/manifest.json
new file mode 100644
index 00000000..8c012917
--- /dev/null
+++ b/example/web/manifest.json
@@ -0,0 +1,23 @@
+{
+ "name": "example",
+ "short_name": "example",
+ "start_url": ".",
+ "display": "standalone",
+ "background_color": "#0175C2",
+ "theme_color": "#0175C2",
+ "description": "A new Flutter project.",
+ "orientation": "portrait-primary",
+ "prefer_related_applications": false,
+ "icons": [
+ {
+ "src": "icons/Icon-192.png",
+ "sizes": "192x192",
+ "type": "image/png"
+ },
+ {
+ "src": "icons/Icon-512.png",
+ "sizes": "512x512",
+ "type": "image/png"
+ }
+ ]
+}
diff --git a/example/windows/.gitignore b/example/windows/.gitignore
new file mode 100644
index 00000000..d492d0d9
--- /dev/null
+++ b/example/windows/.gitignore
@@ -0,0 +1,17 @@
+flutter/ephemeral/
+
+# Visual Studio user-specific files.
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# Visual Studio build-related files.
+x64/
+x86/
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
diff --git a/example/windows/CMakeLists.txt b/example/windows/CMakeLists.txt
new file mode 100644
index 00000000..abf90408
--- /dev/null
+++ b/example/windows/CMakeLists.txt
@@ -0,0 +1,95 @@
+cmake_minimum_required(VERSION 3.15)
+project(example LANGUAGES CXX)
+
+set(BINARY_NAME "example")
+
+cmake_policy(SET CMP0063 NEW)
+
+set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
+
+# Configure build options.
+get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(IS_MULTICONFIG)
+ set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
+ CACHE STRING "" FORCE)
+else()
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_TYPE "Debug" CACHE
+ STRING "Flutter build mode" FORCE)
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
+ "Debug" "Profile" "Release")
+ endif()
+endif()
+
+set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
+set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
+set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
+set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
+
+# Use Unicode for all projects.
+add_definitions(-DUNICODE -D_UNICODE)
+
+# Compilation settings that should be applied to most targets.
+function(APPLY_STANDARD_SETTINGS TARGET)
+ target_compile_features(${TARGET} PUBLIC cxx_std_17)
+ target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
+ target_compile_options(${TARGET} PRIVATE /EHsc)
+ target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
+ target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
+endfunction()
+
+set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
+
+# Flutter library and tool build rules.
+add_subdirectory(${FLUTTER_MANAGED_DIR})
+
+# Application build
+add_subdirectory("runner")
+
+# Generated plugin build rules, which manage building the plugins and adding
+# them to the application.
+include(flutter/generated_plugins.cmake)
+
+
+# === Installation ===
+# Support files are copied into place next to the executable, so that it can
+# run in place. This is done instead of making a separate bundle (as on Linux)
+# so that building and running from within Visual Studio will work.
+set(BUILD_BUNDLE_DIR "$")
+# Make the "install" step default, as it's required to run.
+set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
+endif()
+
+set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
+set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
+
+install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
+ COMPONENT Runtime)
+
+install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
+ COMPONENT Runtime)
+
+install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
+ COMPONENT Runtime)
+
+if(PLUGIN_BUNDLED_LIBRARIES)
+ install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
+ DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
+ COMPONENT Runtime)
+endif()
+
+# Fully re-copy the assets directory on each build to avoid having stale files
+# from a previous install.
+set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
+install(CODE "
+ file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
+ " COMPONENT Runtime)
+install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
+ DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
+
+# Install the AOT library on non-Debug builds only.
+install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
+ CONFIGURATIONS Profile;Release
+ COMPONENT Runtime)
diff --git a/example/windows/flutter/CMakeLists.txt b/example/windows/flutter/CMakeLists.txt
new file mode 100644
index 00000000..b02c5485
--- /dev/null
+++ b/example/windows/flutter/CMakeLists.txt
@@ -0,0 +1,103 @@
+cmake_minimum_required(VERSION 3.15)
+
+set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
+
+# Configuration provided via flutter tool.
+include(${EPHEMERAL_DIR}/generated_config.cmake)
+
+# TODO: Move the rest of this into files in ephemeral. See
+# https://github.com/flutter/flutter/issues/57146.
+set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
+
+# === Flutter Library ===
+set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
+
+# Published to parent scope for install step.
+set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
+set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
+set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
+set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
+
+list(APPEND FLUTTER_LIBRARY_HEADERS
+ "flutter_export.h"
+ "flutter_windows.h"
+ "flutter_messenger.h"
+ "flutter_plugin_registrar.h"
+ "flutter_texture_registrar.h"
+)
+list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
+add_library(flutter INTERFACE)
+target_include_directories(flutter INTERFACE
+ "${EPHEMERAL_DIR}"
+)
+target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
+add_dependencies(flutter flutter_assemble)
+
+# === Wrapper ===
+list(APPEND CPP_WRAPPER_SOURCES_CORE
+ "core_implementations.cc"
+ "standard_codec.cc"
+)
+list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
+list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
+ "plugin_registrar.cc"
+)
+list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
+list(APPEND CPP_WRAPPER_SOURCES_APP
+ "flutter_engine.cc"
+ "flutter_view_controller.cc"
+)
+list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
+
+# Wrapper sources needed for a plugin.
+add_library(flutter_wrapper_plugin STATIC
+ ${CPP_WRAPPER_SOURCES_CORE}
+ ${CPP_WRAPPER_SOURCES_PLUGIN}
+)
+apply_standard_settings(flutter_wrapper_plugin)
+set_target_properties(flutter_wrapper_plugin PROPERTIES
+ POSITION_INDEPENDENT_CODE ON)
+set_target_properties(flutter_wrapper_plugin PROPERTIES
+ CXX_VISIBILITY_PRESET hidden)
+target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
+target_include_directories(flutter_wrapper_plugin PUBLIC
+ "${WRAPPER_ROOT}/include"
+)
+add_dependencies(flutter_wrapper_plugin flutter_assemble)
+
+# Wrapper sources needed for the runner.
+add_library(flutter_wrapper_app STATIC
+ ${CPP_WRAPPER_SOURCES_CORE}
+ ${CPP_WRAPPER_SOURCES_APP}
+)
+apply_standard_settings(flutter_wrapper_app)
+target_link_libraries(flutter_wrapper_app PUBLIC flutter)
+target_include_directories(flutter_wrapper_app PUBLIC
+ "${WRAPPER_ROOT}/include"
+)
+add_dependencies(flutter_wrapper_app flutter_assemble)
+
+# === Flutter tool backend ===
+# _phony_ is a non-existent file to force this command to run every time,
+# since currently there's no way to get a full input/output list from the
+# flutter tool.
+set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
+set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
+add_custom_command(
+ OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
+ ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
+ ${CPP_WRAPPER_SOURCES_APP}
+ ${PHONY_OUTPUT}
+ COMMAND ${CMAKE_COMMAND} -E env
+ ${FLUTTER_TOOL_ENVIRONMENT}
+ "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
+ windows-x64 $
+ VERBATIM
+)
+add_custom_target(flutter_assemble DEPENDS
+ "${FLUTTER_LIBRARY}"
+ ${FLUTTER_LIBRARY_HEADERS}
+ ${CPP_WRAPPER_SOURCES_CORE}
+ ${CPP_WRAPPER_SOURCES_PLUGIN}
+ ${CPP_WRAPPER_SOURCES_APP}
+)
diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc
new file mode 100644
index 00000000..4bfa0f3a
--- /dev/null
+++ b/example/windows/flutter/generated_plugin_registrant.cc
@@ -0,0 +1,9 @@
+//
+// Generated file. Do not edit.
+//
+
+#include "generated_plugin_registrant.h"
+
+
+void RegisterPlugins(flutter::PluginRegistry* registry) {
+}
diff --git a/example/windows/flutter/generated_plugin_registrant.h b/example/windows/flutter/generated_plugin_registrant.h
new file mode 100644
index 00000000..9846246b
--- /dev/null
+++ b/example/windows/flutter/generated_plugin_registrant.h
@@ -0,0 +1,13 @@
+//
+// Generated file. Do not edit.
+//
+
+#ifndef GENERATED_PLUGIN_REGISTRANT_
+#define GENERATED_PLUGIN_REGISTRANT_
+
+#include
+
+// Registers Flutter plugins.
+void RegisterPlugins(flutter::PluginRegistry* registry);
+
+#endif // GENERATED_PLUGIN_REGISTRANT_
diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake
new file mode 100644
index 00000000..4d10c251
--- /dev/null
+++ b/example/windows/flutter/generated_plugins.cmake
@@ -0,0 +1,15 @@
+#
+# Generated file, do not edit.
+#
+
+list(APPEND FLUTTER_PLUGIN_LIST
+)
+
+set(PLUGIN_BUNDLED_LIBRARIES)
+
+foreach(plugin ${FLUTTER_PLUGIN_LIST})
+ add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
+ target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
+ list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
+ list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
+endforeach(plugin)
diff --git a/example/windows/runner/CMakeLists.txt b/example/windows/runner/CMakeLists.txt
new file mode 100644
index 00000000..977e38b5
--- /dev/null
+++ b/example/windows/runner/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.15)
+project(runner LANGUAGES CXX)
+
+add_executable(${BINARY_NAME} WIN32
+ "flutter_window.cpp"
+ "main.cpp"
+ "run_loop.cpp"
+ "utils.cpp"
+ "win32_window.cpp"
+ "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
+ "Runner.rc"
+ "runner.exe.manifest"
+)
+apply_standard_settings(${BINARY_NAME})
+target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
+target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
+target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
+add_dependencies(${BINARY_NAME} flutter_assemble)
diff --git a/example/windows/runner/Runner.rc b/example/windows/runner/Runner.rc
new file mode 100644
index 00000000..ad519398
--- /dev/null
+++ b/example/windows/runner/Runner.rc
@@ -0,0 +1,121 @@
+// Microsoft Visual C++ generated resource script.
+//
+#pragma code_page(65001)
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United States) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_APP_ICON ICON "resources\\app_icon.ico"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+#ifdef FLUTTER_BUILD_NUMBER
+#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
+#else
+#define VERSION_AS_NUMBER 1,0,0
+#endif
+
+#ifdef FLUTTER_BUILD_NAME
+#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
+#else
+#define VERSION_AS_STRING "1.0.0"
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION VERSION_AS_NUMBER
+ PRODUCTVERSION VERSION_AS_NUMBER
+ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_APP
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "io.apparence" "\0"
+ VALUE "FileDescription", "A new Flutter project." "\0"
+ VALUE "FileVersion", VERSION_AS_STRING "\0"
+ VALUE "InternalName", "example" "\0"
+ VALUE "LegalCopyright", "Copyright (C) 2021 io.apparence. All rights reserved." "\0"
+ VALUE "OriginalFilename", "example.exe" "\0"
+ VALUE "ProductName", "example" "\0"
+ VALUE "ProductVersion", VERSION_AS_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff --git a/example/windows/runner/flutter_window.cpp b/example/windows/runner/flutter_window.cpp
new file mode 100644
index 00000000..c4227230
--- /dev/null
+++ b/example/windows/runner/flutter_window.cpp
@@ -0,0 +1,64 @@
+#include "flutter_window.h"
+
+#include
+
+#include "flutter/generated_plugin_registrant.h"
+
+FlutterWindow::FlutterWindow(RunLoop* run_loop,
+ const flutter::DartProject& project)
+ : run_loop_(run_loop), project_(project) {}
+
+FlutterWindow::~FlutterWindow() {}
+
+bool FlutterWindow::OnCreate() {
+ if (!Win32Window::OnCreate()) {
+ return false;
+ }
+
+ RECT frame = GetClientArea();
+
+ // The size here must match the window dimensions to avoid unnecessary surface
+ // creation / destruction in the startup path.
+ flutter_controller_ = std::make_unique(
+ frame.right - frame.left, frame.bottom - frame.top, project_);
+ // Ensure that basic setup of the controller was successful.
+ if (!flutter_controller_->engine() || !flutter_controller_->view()) {
+ return false;
+ }
+ RegisterPlugins(flutter_controller_->engine());
+ run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
+ SetChildContent(flutter_controller_->view()->GetNativeWindow());
+ return true;
+}
+
+void FlutterWindow::OnDestroy() {
+ if (flutter_controller_) {
+ run_loop_->UnregisterFlutterInstance(flutter_controller_->engine());
+ flutter_controller_ = nullptr;
+ }
+
+ Win32Window::OnDestroy();
+}
+
+LRESULT
+FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
+ WPARAM const wparam,
+ LPARAM const lparam) noexcept {
+ // Give Flutter, including plugins, an opporutunity to handle window messages.
+ if (flutter_controller_) {
+ std::optional result =
+ flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
+ lparam);
+ if (result) {
+ return *result;
+ }
+ }
+
+ switch (message) {
+ case WM_FONTCHANGE:
+ flutter_controller_->engine()->ReloadSystemFonts();
+ break;
+ }
+
+ return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
+}
diff --git a/example/windows/runner/flutter_window.h b/example/windows/runner/flutter_window.h
new file mode 100644
index 00000000..b663ddd5
--- /dev/null
+++ b/example/windows/runner/flutter_window.h
@@ -0,0 +1,39 @@
+#ifndef RUNNER_FLUTTER_WINDOW_H_
+#define RUNNER_FLUTTER_WINDOW_H_
+
+#include
+#include
+
+#include
+
+#include "run_loop.h"
+#include "win32_window.h"
+
+// A window that does nothing but host a Flutter view.
+class FlutterWindow : public Win32Window {
+ public:
+ // Creates a new FlutterWindow driven by the |run_loop|, hosting a
+ // Flutter view running |project|.
+ explicit FlutterWindow(RunLoop* run_loop,
+ const flutter::DartProject& project);
+ virtual ~FlutterWindow();
+
+ protected:
+ // Win32Window:
+ bool OnCreate() override;
+ void OnDestroy() override;
+ LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
+ LPARAM const lparam) noexcept override;
+
+ private:
+ // The run loop driving events for this window.
+ RunLoop* run_loop_;
+
+ // The project to run.
+ flutter::DartProject project_;
+
+ // The Flutter instance hosted by this window.
+ std::unique_ptr flutter_controller_;
+};
+
+#endif // RUNNER_FLUTTER_WINDOW_H_
diff --git a/example/windows/runner/main.cpp b/example/windows/runner/main.cpp
new file mode 100644
index 00000000..b637809b
--- /dev/null
+++ b/example/windows/runner/main.cpp
@@ -0,0 +1,42 @@
+#include
+#include
+#include
+
+#include "flutter_window.h"
+#include "run_loop.h"
+#include "utils.h"
+
+int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
+ _In_ wchar_t *command_line, _In_ int show_command) {
+ // Attach to console when present (e.g., 'flutter run') or create a
+ // new console when running with a debugger.
+ if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
+ CreateAndAttachConsole();
+ }
+
+ // Initialize COM, so that it is available for use in the library and/or
+ // plugins.
+ ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
+
+ RunLoop run_loop;
+
+ flutter::DartProject project(L"data");
+
+ std::vector command_line_arguments =
+ GetCommandLineArguments();
+
+ project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
+
+ FlutterWindow window(&run_loop, project);
+ Win32Window::Point origin(10, 10);
+ Win32Window::Size size(1280, 720);
+ if (!window.CreateAndShow(L"example", origin, size)) {
+ return EXIT_FAILURE;
+ }
+ window.SetQuitOnClose(true);
+
+ run_loop.Run();
+
+ ::CoUninitialize();
+ return EXIT_SUCCESS;
+}
diff --git a/example/windows/runner/resource.h b/example/windows/runner/resource.h
new file mode 100644
index 00000000..66a65d1e
--- /dev/null
+++ b/example/windows/runner/resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by Runner.rc
+//
+#define IDI_APP_ICON 101
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 102
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/example/windows/runner/resources/app_icon.ico b/example/windows/runner/resources/app_icon.ico
new file mode 100644
index 00000000..c04e20ca
Binary files /dev/null and b/example/windows/runner/resources/app_icon.ico differ
diff --git a/example/windows/runner/run_loop.cpp b/example/windows/runner/run_loop.cpp
new file mode 100644
index 00000000..2d6636ab
--- /dev/null
+++ b/example/windows/runner/run_loop.cpp
@@ -0,0 +1,66 @@
+#include "run_loop.h"
+
+#include
+
+#include
+
+RunLoop::RunLoop() {}
+
+RunLoop::~RunLoop() {}
+
+void RunLoop::Run() {
+ bool keep_running = true;
+ TimePoint next_flutter_event_time = TimePoint::clock::now();
+ while (keep_running) {
+ std::chrono::nanoseconds wait_duration =
+ std::max(std::chrono::nanoseconds(0),
+ next_flutter_event_time - TimePoint::clock::now());
+ ::MsgWaitForMultipleObjects(
+ 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000),
+ QS_ALLINPUT);
+ bool processed_events = false;
+ MSG message;
+ // All pending Windows messages must be processed; MsgWaitForMultipleObjects
+ // won't return again for items left in the queue after PeekMessage.
+ while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) {
+ processed_events = true;
+ if (message.message == WM_QUIT) {
+ keep_running = false;
+ break;
+ }
+ ::TranslateMessage(&message);
+ ::DispatchMessage(&message);
+ // Allow Flutter to process messages each time a Windows message is
+ // processed, to prevent starvation.
+ next_flutter_event_time =
+ std::min(next_flutter_event_time, ProcessFlutterMessages());
+ }
+ // If the PeekMessage loop didn't run, process Flutter messages.
+ if (!processed_events) {
+ next_flutter_event_time =
+ std::min(next_flutter_event_time, ProcessFlutterMessages());
+ }
+ }
+}
+
+void RunLoop::RegisterFlutterInstance(
+ flutter::FlutterEngine* flutter_instance) {
+ flutter_instances_.insert(flutter_instance);
+}
+
+void RunLoop::UnregisterFlutterInstance(
+ flutter::FlutterEngine* flutter_instance) {
+ flutter_instances_.erase(flutter_instance);
+}
+
+RunLoop::TimePoint RunLoop::ProcessFlutterMessages() {
+ TimePoint next_event_time = TimePoint::max();
+ for (auto instance : flutter_instances_) {
+ std::chrono::nanoseconds wait_duration = instance->ProcessMessages();
+ if (wait_duration != std::chrono::nanoseconds::max()) {
+ next_event_time =
+ std::min(next_event_time, TimePoint::clock::now() + wait_duration);
+ }
+ }
+ return next_event_time;
+}
diff --git a/example/windows/runner/run_loop.h b/example/windows/runner/run_loop.h
new file mode 100644
index 00000000..000d3624
--- /dev/null
+++ b/example/windows/runner/run_loop.h
@@ -0,0 +1,40 @@
+#ifndef RUNNER_RUN_LOOP_H_
+#define RUNNER_RUN_LOOP_H_
+
+#include
+
+#include
+#include
+
+// A runloop that will service events for Flutter instances as well
+// as native messages.
+class RunLoop {
+ public:
+ RunLoop();
+ ~RunLoop();
+
+ // Prevent copying
+ RunLoop(RunLoop const&) = delete;
+ RunLoop& operator=(RunLoop const&) = delete;
+
+ // Runs the run loop until the application quits.
+ void Run();
+
+ // Registers the given Flutter instance for event servicing.
+ void RegisterFlutterInstance(
+ flutter::FlutterEngine* flutter_instance);
+
+ // Unregisters the given Flutter instance from event servicing.
+ void UnregisterFlutterInstance(
+ flutter::FlutterEngine* flutter_instance);
+
+ private:
+ using TimePoint = std::chrono::steady_clock::time_point;
+
+ // Processes all currently pending messages for registered Flutter instances.
+ TimePoint ProcessFlutterMessages();
+
+ std::set flutter_instances_;
+};
+
+#endif // RUNNER_RUN_LOOP_H_
diff --git a/example/windows/runner/runner.exe.manifest b/example/windows/runner/runner.exe.manifest
new file mode 100644
index 00000000..c977c4a4
--- /dev/null
+++ b/example/windows/runner/runner.exe.manifest
@@ -0,0 +1,20 @@
+
+
+
+
+ PerMonitorV2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/windows/runner/utils.cpp b/example/windows/runner/utils.cpp
new file mode 100644
index 00000000..d19bdbbc
--- /dev/null
+++ b/example/windows/runner/utils.cpp
@@ -0,0 +1,64 @@
+#include "utils.h"
+
+#include
+#include
+#include
+#include
+
+#include
+
+void CreateAndAttachConsole() {
+ if (::AllocConsole()) {
+ FILE *unused;
+ if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
+ _dup2(_fileno(stdout), 1);
+ }
+ if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
+ _dup2(_fileno(stdout), 2);
+ }
+ std::ios::sync_with_stdio();
+ FlutterDesktopResyncOutputStreams();
+ }
+}
+
+std::vector GetCommandLineArguments() {
+ // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
+ int argc;
+ wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
+ if (argv == nullptr) {
+ return std::vector();
+ }
+
+ std::vector command_line_arguments;
+
+ // Skip the first argument as it's the binary name.
+ for (int i = 1; i < argc; i++) {
+ command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
+ }
+
+ ::LocalFree(argv);
+
+ return command_line_arguments;
+}
+
+std::string Utf8FromUtf16(const wchar_t* utf16_string) {
+ if (utf16_string == nullptr) {
+ return std::string();
+ }
+ int target_length = ::WideCharToMultiByte(
+ CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
+ -1, nullptr, 0, nullptr, nullptr);
+ if (target_length == 0) {
+ return std::string();
+ }
+ std::string utf8_string;
+ utf8_string.resize(target_length);
+ int converted_length = ::WideCharToMultiByte(
+ CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
+ -1, utf8_string.data(),
+ target_length, nullptr, nullptr);
+ if (converted_length == 0) {
+ return std::string();
+ }
+ return utf8_string;
+}
diff --git a/example/windows/runner/utils.h b/example/windows/runner/utils.h
new file mode 100644
index 00000000..3879d547
--- /dev/null
+++ b/example/windows/runner/utils.h
@@ -0,0 +1,19 @@
+#ifndef RUNNER_UTILS_H_
+#define RUNNER_UTILS_H_
+
+#include
+#include
+
+// Creates a console for the process, and redirects stdout and stderr to
+// it for both the runner and the Flutter library.
+void CreateAndAttachConsole();
+
+// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
+// encoded in UTF-8. Returns an empty std::string on failure.
+std::string Utf8FromUtf16(const wchar_t* utf16_string);
+
+// Gets the command line arguments passed in as a std::vector,
+// encoded in UTF-8. Returns an empty std::vector on failure.
+std::vector GetCommandLineArguments();
+
+#endif // RUNNER_UTILS_H_
diff --git a/example/windows/runner/win32_window.cpp b/example/windows/runner/win32_window.cpp
new file mode 100644
index 00000000..c10f08dc
--- /dev/null
+++ b/example/windows/runner/win32_window.cpp
@@ -0,0 +1,245 @@
+#include "win32_window.h"
+
+#include
+
+#include "resource.h"
+
+namespace {
+
+constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
+
+// The number of Win32Window objects that currently exist.
+static int g_active_window_count = 0;
+
+using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd);
+
+// Scale helper to convert logical scaler values to physical using passed in
+// scale factor
+int Scale(int source, double scale_factor) {
+ return static_cast(source * scale_factor);
+}
+
+// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module.
+// This API is only needed for PerMonitor V1 awareness mode.
+void EnableFullDpiSupportIfAvailable(HWND hwnd) {
+ HMODULE user32_module = LoadLibraryA("User32.dll");
+ if (!user32_module) {
+ return;
+ }
+ auto enable_non_client_dpi_scaling =
+ reinterpret_cast(
+ GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
+ if (enable_non_client_dpi_scaling != nullptr) {
+ enable_non_client_dpi_scaling(hwnd);
+ FreeLibrary(user32_module);
+ }
+}
+
+} // namespace
+
+// Manages the Win32Window's window class registration.
+class WindowClassRegistrar {
+ public:
+ ~WindowClassRegistrar() = default;
+
+ // Returns the singleton registar instance.
+ static WindowClassRegistrar* GetInstance() {
+ if (!instance_) {
+ instance_ = new WindowClassRegistrar();
+ }
+ return instance_;
+ }
+
+ // Returns the name of the window class, registering the class if it hasn't
+ // previously been registered.
+ const wchar_t* GetWindowClass();
+
+ // Unregisters the window class. Should only be called if there are no
+ // instances of the window.
+ void UnregisterWindowClass();
+
+ private:
+ WindowClassRegistrar() = default;
+
+ static WindowClassRegistrar* instance_;
+
+ bool class_registered_ = false;
+};
+
+WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr;
+
+const wchar_t* WindowClassRegistrar::GetWindowClass() {
+ if (!class_registered_) {
+ WNDCLASS window_class{};
+ window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
+ window_class.lpszClassName = kWindowClassName;
+ window_class.style = CS_HREDRAW | CS_VREDRAW;
+ window_class.cbClsExtra = 0;
+ window_class.cbWndExtra = 0;
+ window_class.hInstance = GetModuleHandle(nullptr);
+ window_class.hIcon =
+ LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
+ window_class.hbrBackground = 0;
+ window_class.lpszMenuName = nullptr;
+ window_class.lpfnWndProc = Win32Window::WndProc;
+ RegisterClass(&window_class);
+ class_registered_ = true;
+ }
+ return kWindowClassName;
+}
+
+void WindowClassRegistrar::UnregisterWindowClass() {
+ UnregisterClass(kWindowClassName, nullptr);
+ class_registered_ = false;
+}
+
+Win32Window::Win32Window() {
+ ++g_active_window_count;
+}
+
+Win32Window::~Win32Window() {
+ --g_active_window_count;
+ Destroy();
+}
+
+bool Win32Window::CreateAndShow(const std::wstring& title,
+ const Point& origin,
+ const Size& size) {
+ Destroy();
+
+ const wchar_t* window_class =
+ WindowClassRegistrar::GetInstance()->GetWindowClass();
+
+ const POINT target_point = {static_cast(origin.x),
+ static_cast(origin.y)};
+ HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
+ UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
+ double scale_factor = dpi / 96.0;
+
+ HWND window = CreateWindow(
+ window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ Scale(origin.x, scale_factor), Scale(origin.y, scale_factor),
+ Scale(size.width, scale_factor), Scale(size.height, scale_factor),
+ nullptr, nullptr, GetModuleHandle(nullptr), this);
+
+ if (!window) {
+ return false;
+ }
+
+ return OnCreate();
+}
+
+// static
+LRESULT CALLBACK Win32Window::WndProc(HWND const window,
+ UINT const message,
+ WPARAM const wparam,
+ LPARAM const lparam) noexcept {
+ if (message == WM_NCCREATE) {
+ auto window_struct = reinterpret_cast(lparam);
+ SetWindowLongPtr(window, GWLP_USERDATA,
+ reinterpret_cast(window_struct->lpCreateParams));
+
+ auto that = static_cast(window_struct->lpCreateParams);
+ EnableFullDpiSupportIfAvailable(window);
+ that->window_handle_ = window;
+ } else if (Win32Window* that = GetThisFromHandle(window)) {
+ return that->MessageHandler(window, message, wparam, lparam);
+ }
+
+ return DefWindowProc(window, message, wparam, lparam);
+}
+
+LRESULT
+Win32Window::MessageHandler(HWND hwnd,
+ UINT const message,
+ WPARAM const wparam,
+ LPARAM const lparam) noexcept {
+ switch (message) {
+ case WM_DESTROY:
+ window_handle_ = nullptr;
+ Destroy();
+ if (quit_on_close_) {
+ PostQuitMessage(0);
+ }
+ return 0;
+
+ case WM_DPICHANGED: {
+ auto newRectSize = reinterpret_cast(lparam);
+ LONG newWidth = newRectSize->right - newRectSize->left;
+ LONG newHeight = newRectSize->bottom - newRectSize->top;
+
+ SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
+ newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
+
+ return 0;
+ }
+ case WM_SIZE: {
+ RECT rect = GetClientArea();
+ if (child_content_ != nullptr) {
+ // Size and position the child window.
+ MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
+ rect.bottom - rect.top, TRUE);
+ }
+ return 0;
+ }
+
+ case WM_ACTIVATE:
+ if (child_content_ != nullptr) {
+ SetFocus(child_content_);
+ }
+ return 0;
+ }
+
+ return DefWindowProc(window_handle_, message, wparam, lparam);
+}
+
+void Win32Window::Destroy() {
+ OnDestroy();
+
+ if (window_handle_) {
+ DestroyWindow(window_handle_);
+ window_handle_ = nullptr;
+ }
+ if (g_active_window_count == 0) {
+ WindowClassRegistrar::GetInstance()->UnregisterWindowClass();
+ }
+}
+
+Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
+ return reinterpret_cast(
+ GetWindowLongPtr(window, GWLP_USERDATA));
+}
+
+void Win32Window::SetChildContent(HWND content) {
+ child_content_ = content;
+ SetParent(content, window_handle_);
+ RECT frame = GetClientArea();
+
+ MoveWindow(content, frame.left, frame.top, frame.right - frame.left,
+ frame.bottom - frame.top, true);
+
+ SetFocus(child_content_);
+}
+
+RECT Win32Window::GetClientArea() {
+ RECT frame;
+ GetClientRect(window_handle_, &frame);
+ return frame;
+}
+
+HWND Win32Window::GetHandle() {
+ return window_handle_;
+}
+
+void Win32Window::SetQuitOnClose(bool quit_on_close) {
+ quit_on_close_ = quit_on_close;
+}
+
+bool Win32Window::OnCreate() {
+ // No-op; provided for subclasses.
+ return true;
+}
+
+void Win32Window::OnDestroy() {
+ // No-op; provided for subclasses.
+}
diff --git a/example/windows/runner/win32_window.h b/example/windows/runner/win32_window.h
new file mode 100644
index 00000000..17ba4311
--- /dev/null
+++ b/example/windows/runner/win32_window.h
@@ -0,0 +1,98 @@
+#ifndef RUNNER_WIN32_WINDOW_H_
+#define RUNNER_WIN32_WINDOW_H_
+
+#include
+
+#include
+#include
+#include
+
+// A class abstraction for a high DPI-aware Win32 Window. Intended to be
+// inherited from by classes that wish to specialize with custom
+// rendering and input handling
+class Win32Window {
+ public:
+ struct Point {
+ unsigned int x;
+ unsigned int y;
+ Point(unsigned int x, unsigned int y) : x(x), y(y) {}
+ };
+
+ struct Size {
+ unsigned int width;
+ unsigned int height;
+ Size(unsigned int width, unsigned int height)
+ : width(width), height(height) {}
+ };
+
+ Win32Window();
+ virtual ~Win32Window();
+
+ // Creates and shows a win32 window with |title| and position and size using
+ // |origin| and |size|. New windows are created on the default monitor. Window
+ // sizes are specified to the OS in physical pixels, hence to ensure a
+ // consistent size to will treat the width height passed in to this function
+ // as logical pixels and scale to appropriate for the default monitor. Returns
+ // true if the window was created successfully.
+ bool CreateAndShow(const std::wstring& title,
+ const Point& origin,
+ const Size& size);
+
+ // Release OS resources associated with window.
+ void Destroy();
+
+ // Inserts |content| into the window tree.
+ void SetChildContent(HWND content);
+
+ // Returns the backing Window handle to enable clients to set icon and other
+ // window properties. Returns nullptr if the window has been destroyed.
+ HWND GetHandle();
+
+ // If true, closing this window will quit the application.
+ void SetQuitOnClose(bool quit_on_close);
+
+ // Return a RECT representing the bounds of the current client area.
+ RECT GetClientArea();
+
+ protected:
+ // Processes and route salient window messages for mouse handling,
+ // size change and DPI. Delegates handling of these to member overloads that
+ // inheriting classes can handle.
+ virtual LRESULT MessageHandler(HWND window,
+ UINT const message,
+ WPARAM const wparam,
+ LPARAM const lparam) noexcept;
+
+ // Called when CreateAndShow is called, allowing subclass window-related
+ // setup. Subclasses should return false if setup fails.
+ virtual bool OnCreate();
+
+ // Called when Destroy is called.
+ virtual void OnDestroy();
+
+ private:
+ friend class WindowClassRegistrar;
+
+ // OS callback called by message pump. Handles the WM_NCCREATE message which
+ // is passed when the non-client area is being created and enables automatic
+ // non-client DPI scaling so that the non-client area automatically
+ // responsponds to changes in DPI. All other messages are handled by
+ // MessageHandler.
+ static LRESULT CALLBACK WndProc(HWND const window,
+ UINT const message,
+ WPARAM const wparam,
+ LPARAM const lparam) noexcept;
+
+ // Retrieves a class instance pointer for |window|
+ static Win32Window* GetThisFromHandle(HWND const window) noexcept;
+
+ bool quit_on_close_ = false;
+
+ // window handle for top level window.
+ HWND window_handle_ = nullptr;
+
+ // window handle for hosted content.
+ HWND child_content_ = nullptr;
+};
+
+#endif // RUNNER_WIN32_WINDOW_H_
diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart
index 30fdb7a4..7f9b4d58 100644
--- a/lib/generated/i18n.dart
+++ b/lib/generated/i18n.dart
@@ -11,12 +11,12 @@ import 'package:flutter/material.dart';
class S implements WidgetsLocalizations {
const S();
- static S current;
+ static S? current;
static const GeneratedLocalizationsDelegate delegate =
GeneratedLocalizationsDelegate();
- static S of(BuildContext context) => Localizations.of(context, S);
+ static S? of(BuildContext context) => Localizations.of(context, S);
@override
TextDirection get textDirection => TextDirection.ltr;
@@ -27,7 +27,7 @@ class $en extends S {
const $en();
}
-class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
+class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
const GeneratedLocalizationsDelegate();
List get supportedLocales {
@@ -36,8 +36,8 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
];
}
- LocaleListResolutionCallback listResolution({Locale fallback, bool withCountry = true}) {
- return (List locales, Iterable supported) {
+ LocaleListResolutionCallback listResolution({Locale? fallback, bool withCountry = true}) {
+ return (List? locales, Iterable supported) {
if (locales == null || locales.isEmpty) {
return fallback ?? supported.first;
} else {
@@ -46,26 +46,26 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
};
}
- LocaleResolutionCallback resolution({Locale fallback, bool withCountry = true}) {
- return (Locale locale, Iterable supported) {
+ LocaleResolutionCallback resolution({Locale? fallback, bool withCountry = true}) {
+ return (Locale? locale, Iterable supported) {
return _resolve(locale, fallback, supported, withCountry);
};
}
@override
- Future load(Locale locale) {
+ Future load(Locale locale) {
final String lang = getLang(locale);
if (lang != null) {
switch (lang) {
case "en":
S.current = const $en();
- return SynchronousFuture(S.current);
+ return SynchronousFuture(S.current);
default:
// NO-OP.
}
}
S.current = const S();
- return SynchronousFuture(S.current);
+ return SynchronousFuture(S.current);
}
@override
@@ -77,7 +77,7 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
///
/// Internal method to resolve a locale from a list of locales.
///
- Locale _resolve(Locale locale, Locale fallback, Iterable supported, bool withCountry) {
+ Locale _resolve(Locale? locale, Locale? fallback, Iterable supported, bool withCountry) {
if (locale == null || !_isSupported(locale, withCountry)) {
return fallback ?? supported.first;
}
@@ -110,7 +110,7 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
}
// If no country requirement is requested, check if this locale has no country.
- if (true != withCountry && (supportedLocale.countryCode == null || supportedLocale.countryCode.isEmpty)) {
+ if (true != withCountry && (supportedLocale.countryCode == null || supportedLocale.countryCode!.isEmpty)) {
return true;
}
}
@@ -119,8 +119,5 @@ class GeneratedLocalizationsDelegate extends LocalizationsDelegate {
}
}
-String getLang(Locale l) => l == null
- ? null
- : l.countryCode != null && l.countryCode.isEmpty
- ? l.languageCode
- : l.toString();
+String getLang(Locale? l) => l?.countryCode != null && l!.countryCode!.isEmpty
+ ? l.languageCode : l.toString();
diff --git a/lib/src/database/adapter/app_icon_entity.dart b/lib/src/database/adapter/app_icon_entity.dart
index e9445f5a..9aba1dd3 100644
--- a/lib/src/database/adapter/app_icon_entity.dart
+++ b/lib/src/database/adapter/app_icon_entity.dart
@@ -3,9 +3,9 @@ import 'generic_adapter.dart';
class AppIconEntityAdapter extends GenericEntityAdapter {
@override
- AppIconEntity parseMap(Map map) {
+ AppIconEntity parseMap(Map? map) {
return AppIconEntity(
- id: map['id'],
+ id: map!['id'],
url: map['url'],
);
}
diff --git a/lib/src/database/adapter/generic_adapter.dart b/lib/src/database/adapter/generic_adapter.dart
index fedc0bec..5356dc02 100644
--- a/lib/src/database/adapter/generic_adapter.dart
+++ b/lib/src/database/adapter/generic_adapter.dart
@@ -11,7 +11,7 @@ abstract class GenericEntityAdapter {
String toJson(T model) => json.encode(model);
T parse(String value) {
- Map map = json.decode(value);
+ Map? map = json.decode(value);
try {
return parseMap(map);
} catch (e) {
@@ -46,11 +46,11 @@ abstract class GenericEntityAdapter {
result.entities = this.parseArray(json.encode(page['content']));
return result;
} catch (err) {
- throw "Error while parsing data " + err;
+ throw "Error while parsing data $err";
}
}
- Map decode(String value) {
+ Map? decode(String value) {
return json.decode(value);
}
@@ -58,7 +58,7 @@ abstract class GenericEntityAdapter {
return json.encode(object);
}
- T parseMap(Map map);
+ T parseMap(Map? map);
static checkKey(Map map, String key) {
return map.containsKey(key) && map[key] != null && map[key] != '';
diff --git a/lib/src/database/adapter/helper_entity_adapter.dart b/lib/src/database/adapter/helper_entity_adapter.dart
index 8b9204ef..4ebcb66a 100644
--- a/lib/src/database/adapter/helper_entity_adapter.dart
+++ b/lib/src/database/adapter/helper_entity_adapter.dart
@@ -4,8 +4,8 @@ import 'package:pal/src/database/entity/helper/helper_type.dart';
class HelperEntityAdapter extends GenericEntityAdapter {
@override
- HelperEntity parseMap(Map map) {
- final HelperType helperType = map.containsKey('type') ? getHelperType(map['type']) : null;
+ HelperEntity parseMap(Map? map) {
+ final HelperType? helperType = map!.containsKey('type') ? getHelperType(map['type']) : null;
return HelperEntity(
id: map['id'],
name: map['name'],
@@ -27,9 +27,9 @@ class HelperEntityAdapter extends GenericEntityAdapter {
class HelperBorderEntityAdapter extends GenericEntityAdapter {
@override
- HelperBorderEntity parseMap(Map map) {
+ HelperBorderEntity parseMap(Map? map) {
return HelperBorderEntity(
- id: map['id'],
+ id: map!['id'],
key: map['key'],
color: map['color'],
style: map['style'],
@@ -40,9 +40,9 @@ class HelperBorderEntityAdapter extends GenericEntityAdapter
class HelperImageEntityAdapter extends GenericEntityAdapter {
@override
- HelperImageEntity parseMap(Map map) {
+ HelperImageEntity parseMap(Map? map) {
return HelperImageEntity(
- id: map['id'],
+ id: map!['id'],
key: map['key'],
url: map['url'],
);
@@ -51,9 +51,9 @@ class HelperImageEntityAdapter extends GenericEntityAdapter {
class HelperTextEntityAdapter extends GenericEntityAdapter {
@override
- HelperTextEntity parseMap(Map map) {
+ HelperTextEntity parseMap(Map? map) {
return HelperTextEntity(
- id: map['id'],
+ id: map!['id'],
fontColor: map['fontColor'],
fontFamily: map['fontFamily'],
fontWeight: map['fontWeight'],
@@ -66,9 +66,9 @@ class HelperTextEntityAdapter extends GenericEntityAdapter {
class HelperBoxEntityAdapter extends GenericEntityAdapter {
@override
- HelperBoxEntity parseMap(Map map) {
+ HelperBoxEntity parseMap(Map? map) {
return HelperBoxEntity(
- id: map['id'],
+ id: map!['id'],
key: map['key'],
backgroundColor: map['backgroundColor'],
);
diff --git a/lib/src/database/adapter/helper_group_entity_adapter.dart b/lib/src/database/adapter/helper_group_entity_adapter.dart
index b70754e1..67f4cbeb 100644
--- a/lib/src/database/adapter/helper_group_entity_adapter.dart
+++ b/lib/src/database/adapter/helper_group_entity_adapter.dart
@@ -8,8 +8,8 @@ import 'generic_adapter.dart';
class HelperGroupEntityAdapter extends GenericEntityAdapter {
@override
- HelperGroupEntity parseMap(Map map) {
- final HelperTriggerType helperTriggerType = map.containsKey('triggerType')
+ HelperGroupEntity parseMap(Map? map) {
+ final HelperTriggerType? helperTriggerType = map!.containsKey('triggerType')
? getHelperTriggerType(map['triggerType']) : null;
return HelperGroupEntity(
id: map['id'],
diff --git a/lib/src/database/adapter/helper_group_visit_entity_adapter.dart b/lib/src/database/adapter/helper_group_visit_entity_adapter.dart
index 14f3fcfb..aa44bb60 100644
--- a/lib/src/database/adapter/helper_group_visit_entity_adapter.dart
+++ b/lib/src/database/adapter/helper_group_visit_entity_adapter.dart
@@ -4,9 +4,9 @@ import 'generic_adapter.dart';
class HelperGroupUserVisitEntityAdapter extends GenericEntityAdapter {
@override
- HelperGroupUserVisitEntity parseMap(Map map) {
+ HelperGroupUserVisitEntity parseMap(Map? map) {
return HelperGroupUserVisitEntity(
- helperGroupId: map["helperGroupId"],
+ helperGroupId: map!["helperGroupId"],
pageId: map["pageId"],
visitDate: DateTime.parse(map['time']).toLocal() ,
visitVersion: map["version"],
diff --git a/lib/src/database/adapter/in_app_user_storage_adapter.dart b/lib/src/database/adapter/in_app_user_storage_adapter.dart
index 18a9723e..fb2fc147 100644
--- a/lib/src/database/adapter/in_app_user_storage_adapter.dart
+++ b/lib/src/database/adapter/in_app_user_storage_adapter.dart
@@ -1,11 +1,11 @@
import 'package:pal/src/database/adapter/generic_adapter.dart';
import 'package:pal/src/database/entity/in_app_user_entity.dart';
-class InAppUserEntityAdapter extends GenericEntityAdapter {
+class InAppUserEntityStorageAdapter extends GenericEntityAdapter {
@override
- InAppUserEntity parseMap(Map map) {
+ InAppUserEntity parseMap(Map? map) {
return InAppUserEntity(
- id: map["id"],
+ id: map!["id"],
inAppId: map["inAppId"],
anonymous: map["anonymous"],
disabledHelpers: map["disabledHelpers"],
diff --git a/lib/src/database/adapter/page_entity_adapter.dart b/lib/src/database/adapter/page_entity_adapter.dart
index e26e1ff7..06ddb4cd 100644
--- a/lib/src/database/adapter/page_entity_adapter.dart
+++ b/lib/src/database/adapter/page_entity_adapter.dart
@@ -3,9 +3,9 @@ import 'package:pal/src/database/entity/page_entity.dart';
class PageEntityAdapter extends GenericEntityAdapter {
@override
- PageEntity parseMap(Map map) {
+ PageEntity parseMap(Map? map) {
return PageEntity(
- id: map['id'],
+ id: map!['id'],
creationDate: map['creationDate'] != null ? DateTime.parse(map['creationDate']).toLocal() : null,
lastUpdateDate: map['lastUpdateDate'] != null ? DateTime.parse(map['lastUpdateDate']).toLocal() : null,
route: map['route'],
diff --git a/lib/src/database/adapter/project_gallery_entity_adapter.dart b/lib/src/database/adapter/project_gallery_entity_adapter.dart
index e9f766b0..54185c82 100644
--- a/lib/src/database/adapter/project_gallery_entity_adapter.dart
+++ b/lib/src/database/adapter/project_gallery_entity_adapter.dart
@@ -3,9 +3,9 @@ import 'generic_adapter.dart';
class ProjectGalleryEntityAdapter extends GenericEntityAdapter {
@override
- GraphicEntity parseMap(Map map) {
+ GraphicEntity parseMap(Map? map) {
return GraphicEntity(
- id: map['id'],
+ id: map!['id'],
url: map['url'],
uploadedDate: DateTime.parse(map['uploadedDate']).toLocal(),
);
diff --git a/lib/src/database/adapter/schema_entity_adapter.dart b/lib/src/database/adapter/schema_entity_adapter.dart
index 06403b9f..cfc36148 100644
--- a/lib/src/database/adapter/schema_entity_adapter.dart
+++ b/lib/src/database/adapter/schema_entity_adapter.dart
@@ -6,9 +6,9 @@ import 'generic_adapter.dart';
class SchemaEntityAdapter extends GenericEntityAdapter {
@override
- SchemaEntity parseMap(Map map) {
+ SchemaEntity parseMap(Map? map) {
return SchemaEntity(
- projectId: map['projectId'],
+ projectId: map!['projectId'],
groups: new HelperGroupEntityAdapter().parseDynamicArray(map['groups']),
schemaVersion: map['schemaVersion'],
);
diff --git a/lib/src/database/adapter/version_entity_adapter.dart b/lib/src/database/adapter/version_entity_adapter.dart
index ab2bdd33..e3d2f811 100644
--- a/lib/src/database/adapter/version_entity_adapter.dart
+++ b/lib/src/database/adapter/version_entity_adapter.dart
@@ -4,9 +4,9 @@ import 'generic_adapter.dart';
class VersionEntityAdapter extends GenericEntityAdapter {
@override
- VersionEntity parseMap(Map map) {
+ VersionEntity parseMap(Map? map) {
return VersionEntity(
- id: map['id'],
+ id: map!['id'],
name: map['name']
);
}
diff --git a/lib/src/database/entity/app_icon_entity.dart b/lib/src/database/entity/app_icon_entity.dart
index 466f476f..af8e090c 100644
--- a/lib/src/database/entity/app_icon_entity.dart
+++ b/lib/src/database/entity/app_icon_entity.dart
@@ -1,6 +1,6 @@
class AppIconEntity {
- String id;
- String url;
+ String? id;
+ String? url;
AppIconEntity({
this.id,
diff --git a/lib/src/database/entity/graphic_entity.dart b/lib/src/database/entity/graphic_entity.dart
index 8e93689e..8f4f760b 100644
--- a/lib/src/database/entity/graphic_entity.dart
+++ b/lib/src/database/entity/graphic_entity.dart
@@ -1,7 +1,7 @@
class GraphicEntity {
- String id;
- String url;
- DateTime uploadedDate;
+ String? id;
+ String? url;
+ DateTime? uploadedDate;
GraphicEntity({
this.id,
diff --git a/lib/src/database/entity/helper/helper_entity.dart b/lib/src/database/entity/helper/helper_entity.dart
index d8fe68e5..12b16431 100644
--- a/lib/src/database/entity/helper/helper_entity.dart
+++ b/lib/src/database/entity/helper/helper_entity.dart
@@ -8,37 +8,37 @@ part 'helper_entity.g.dart';
@HiveType(typeId: 3)
class HelperEntity with Comparable {
@HiveField(0)
- String id;
+ String? id;
@HiveField(1)
- DateTime creationDate;
+ DateTime? creationDate;
@HiveField(2)
- DateTime lastUpdateDate;
+ DateTime? lastUpdateDate;
@HiveField(3)
- String name;
+ String? name;
@HiveField(4)
- int priority;
+ int? priority;
@HiveField(5)
- HelperType type;
+ HelperType? type;
@HiveField(6)
- HelperTriggerType triggerType;
+ HelperTriggerType? triggerType;
@HiveField(11)
- List helperBorders;
+ List? helperBorders;
@HiveField(12)
- List helperImages;
+ List? helperImages;
@HiveField(13)
- List helperTexts;
+ List? helperTexts;
@HiveField(14)
- List helperBoxes;
+ List? helperBoxes;
HelperEntity(
{this.id,
@@ -63,21 +63,21 @@ class HelperEntity with Comparable {
lastUpdateDate: from.lastUpdateDate,
priority: from.priority,
helperBorders:
- from.helperBorders != null ? [...from.helperBorders] : null,
- helperImages: from.helperImages != null ? [...from.helperImages] : null,
- helperTexts: from.helperTexts != null ? [...from.helperTexts] : null,
- helperBoxes: from.helperBoxes != null ? [...from.helperBoxes] : null,
+ from.helperBorders != null ? [...from.helperBorders!] : null,
+ helperImages: from.helperImages != null ? [...from.helperImages!] : null,
+ helperTexts: from.helperTexts != null ? [...from.helperTexts!] : null,
+ helperBoxes: from.helperBoxes != null ? [...from.helperBoxes!] : null,
);
}
Map toJson() => {
'id': id,
'name': name,
- 'type': type?.toString()?.split('.')[1],
+ 'type': type?.toString().split('.')[1],
'creationDate':
- creationDate != null ? creationDate.toIso8601String() : null,
+ creationDate != null ? creationDate!.toIso8601String() : null,
'lastUpdateDate':
- lastUpdateDate != null ? lastUpdateDate.toIso8601String() : null,
+ lastUpdateDate != null ? lastUpdateDate!.toIso8601String() : null,
'priority': priority,
'helperBorders': helperBorders,
'helperImages': helperImages,
@@ -104,7 +104,7 @@ class HelperEntity with Comparable {
@override
int compareTo(HelperEntity other) {
return other != null && this != null
- ? other.priority < this.priority
+ ? other.priority! < this.priority!
? 1
: -1
: 0;
@@ -127,19 +127,19 @@ class HelperEntity with Comparable {
@HiveType(typeId: 4)
class HelperBorderEntity {
@HiveField(0)
- int id;
+ int? id;
@HiveField(1)
- String color;
+ String? color;
@HiveField(2)
- String key;
+ String? key;
@HiveField(3)
- String style;
+ String? style;
@HiveField(4)
- double width;
+ double? width;
HelperBorderEntity({this.id, this.color, this.key, this.style, this.width});
@@ -181,13 +181,13 @@ class HelperBorderEntity {
@HiveType(typeId: 5)
class HelperImageEntity {
@HiveField(0)
- int id;
+ int? id;
@HiveField(1)
- String key;
+ String? key;
@HiveField(2)
- String url;
+ String? url;
Map toJson() => {
'id': id,
@@ -195,7 +195,7 @@ class HelperImageEntity {
'url': url,
};
- HelperImageEntity({this.id, this.key, @required this.url});
+ HelperImageEntity({this.id, this.key, required this.url});
HelperImageEntity copy() => HelperImageEntity(id: id, key: key, url: url);
@@ -214,25 +214,25 @@ class HelperImageEntity {
@HiveType(typeId: 6)
class HelperTextEntity {
@HiveField(0)
- int id;
+ int? id;
@HiveField(1)
- String fontColor;
+ String? fontColor;
@HiveField(2)
- String fontFamily;
+ String? fontFamily;
@HiveField(3)
- String fontWeight;
+ String? fontWeight;
@HiveField(4)
- String key;
+ String? key;
@HiveField(5)
- String value;
+ String? value;
@HiveField(6)
- int fontSize;
+ int? fontSize;
HelperTextEntity({
this.id,
@@ -289,17 +289,17 @@ class HelperTextEntity {
@HiveType(typeId: 7)
class HelperBoxEntity {
@HiveField(0)
- int id;
+ int? id;
@HiveField(1)
- String backgroundColor;
+ String? backgroundColor;
@HiveField(2)
- String key;
+ String? key;
HelperBoxEntity({
this.id,
- @required this.backgroundColor,
+ required this.backgroundColor,
this.key,
});
diff --git a/lib/src/database/entity/helper/helper_entity.g.dart b/lib/src/database/entity/helper/helper_entity.g.dart
index 6a44894b..8610fbc9 100644
--- a/lib/src/database/entity/helper/helper_entity.g.dart
+++ b/lib/src/database/entity/helper/helper_entity.g.dart
@@ -17,17 +17,17 @@ class HelperEntityAdapter extends TypeAdapter {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return HelperEntity(
- id: fields[0] as String,
- name: fields[3] as String,
- type: fields[5] as HelperType,
- triggerType: fields[6] as HelperTriggerType,
- creationDate: fields[1] as DateTime,
- lastUpdateDate: fields[2] as DateTime,
- priority: fields[4] as int,
- helperBorders: (fields[11] as List)?.cast(),
- helperImages: (fields[12] as List)?.cast(),
- helperTexts: (fields[13] as List)?.cast(),
- helperBoxes: (fields[14] as List)?.cast(),
+ id: fields[0] as String?,
+ name: fields[3] as String?,
+ type: fields[5] as HelperType?,
+ triggerType: fields[6] as HelperTriggerType?,
+ creationDate: fields[1] as DateTime?,
+ lastUpdateDate: fields[2] as DateTime?,
+ priority: fields[4] as int?,
+ helperBorders: (fields[11] as List?)?.cast(),
+ helperImages: (fields[12] as List?)?.cast(),
+ helperTexts: (fields[13] as List?)?.cast(),
+ helperBoxes: (fields[14] as List?)?.cast(),
);
}
@@ -81,11 +81,11 @@ class HelperBorderEntityAdapter extends TypeAdapter {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return HelperBorderEntity(
- id: fields[0] as int,
- color: fields[1] as String,
- key: fields[2] as String,
- style: fields[3] as String,
- width: fields[4] as double,
+ id: fields[0] as int?,
+ color: fields[1] as String?,
+ key: fields[2] as String?,
+ style: fields[3] as String?,
+ width: fields[4] as double?,
);
}
@@ -127,9 +127,9 @@ class HelperImageEntityAdapter extends TypeAdapter {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return HelperImageEntity(
- id: fields[0] as int,
- key: fields[1] as String,
- url: fields[2] as String,
+ id: fields[0] as int?,
+ key: fields[1] as String?,
+ url: fields[2] as String?,
);
}
@@ -167,13 +167,13 @@ class HelperTextEntityAdapter extends TypeAdapter {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return HelperTextEntity(
- id: fields[0] as int,
- fontColor: fields[1] as String,
- fontFamily: fields[2] as String,
- fontWeight: fields[3] as String,
- key: fields[4] as String,
- value: fields[5] as String,
- fontSize: fields[6] as int,
+ id: fields[0] as int?,
+ fontColor: fields[1] as String?,
+ fontFamily: fields[2] as String?,
+ fontWeight: fields[3] as String?,
+ key: fields[4] as String?,
+ value: fields[5] as String?,
+ fontSize: fields[6] as int?,
);
}
@@ -219,9 +219,9 @@ class HelperBoxEntityAdapter extends TypeAdapter {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return HelperBoxEntity(
- id: fields[0] as int,
- backgroundColor: fields[1] as String,
- key: fields[2] as String,
+ id: fields[0] as int?,
+ backgroundColor: fields[1] as String?,
+ key: fields[2] as String?,
);
}
diff --git a/lib/src/database/entity/helper/helper_group_entity.dart b/lib/src/database/entity/helper/helper_group_entity.dart
index 32af80a7..96a9bd59 100644
--- a/lib/src/database/entity/helper/helper_group_entity.dart
+++ b/lib/src/database/entity/helper/helper_group_entity.dart
@@ -12,31 +12,31 @@ part 'helper_group_entity.g.dart';
class HelperGroupEntity with Comparable {
@HiveField(0)
- String id;
+ String? id;
@HiveField(1)
- int priority;
+ int? priority;
@HiveField(2)
- List helpers;
+ List? helpers;
@HiveField(3)
- PageEntity page;
+ PageEntity? page;
@HiveField(4)
- String name;
+ String? name;
@HiveField(5)
- HelperTriggerType triggerType;
+ HelperTriggerType? triggerType;
@HiveField(6)
- DateTime creationDate;
+ DateTime? creationDate;
@HiveField(7)
- String minVersion;
+ String? minVersion;
@HiveField(8)
- String maxVersion;
+ String? maxVersion;
HelperGroupEntity({
this.id,
@@ -53,7 +53,7 @@ class HelperGroupEntity with Comparable {
@override
int compareTo(HelperGroupEntity other) {
if(other.triggerType == this.triggerType) {
- return other.priority < this.priority ? 1 : -1;
+ return other.priority! < this.priority! ? 1 : -1;
}
return other.triggerType.typePriority < this.triggerType.typePriority ? 1 : -1;
}
diff --git a/lib/src/database/entity/helper/helper_group_entity.g.dart b/lib/src/database/entity/helper/helper_group_entity.g.dart
index dc184bcc..efe9491f 100644
--- a/lib/src/database/entity/helper/helper_group_entity.g.dart
+++ b/lib/src/database/entity/helper/helper_group_entity.g.dart
@@ -17,15 +17,15 @@ class HelperGroupEntityAdapter extends TypeAdapter {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return HelperGroupEntity(
- id: fields[0] as String,
- priority: fields[1] as int,
- helpers: (fields[2] as List)?.cast(),
- page: fields[3] as PageEntity,
- name: fields[4] as String,
- triggerType: fields[5] as HelperTriggerType,
- creationDate: fields[6] as DateTime,
- minVersion: fields[7] as String,
- maxVersion: fields[8] as String,
+ id: fields[0] as String?,
+ priority: fields[1] as int?,
+ helpers: (fields[2] as List?)?.cast(),
+ page: fields[3] as PageEntity?,
+ name: fields[4] as String?,
+ triggerType: fields[5] as HelperTriggerType?,
+ creationDate: fields[6] as DateTime?,
+ minVersion: fields[7] as String?,
+ maxVersion: fields[8] as String?,
);
}
diff --git a/lib/src/database/entity/helper/helper_trigger_type.dart b/lib/src/database/entity/helper/helper_trigger_type.dart
index b7ff39e3..6f82d38d 100644
--- a/lib/src/database/entity/helper/helper_trigger_type.dart
+++ b/lib/src/database/entity/helper/helper_trigger_type.dart
@@ -11,14 +11,14 @@ enum HelperTriggerType {
ON_NEW_UPDATE,
}
-HelperTriggerType getHelperTriggerType(final String value) =>
+HelperTriggerType getHelperTriggerType(final String? value) =>
HelperTriggerType.values
.firstWhere((element) => element.toString().split('.')[1] == value);
-String helperTriggerTypeToString(final HelperTriggerType helperTriggerType) =>
+String helperTriggerTypeToString(final HelperTriggerType? helperTriggerType) =>
helperTriggerType.toString().split('.')[1];
-extension HelperTriggerTypeExt on HelperTriggerType {
+extension HelperTriggerTypeExt on HelperTriggerType? {
String get description {
switch (this) {
case HelperTriggerType.ON_SCREEN_VISIT:
@@ -41,9 +41,9 @@ extension HelperTriggerTypeExt on HelperTriggerType {
}
// FIXME replace by extension
-String getHelperTriggerTypeDescription(
+String? getHelperTriggerTypeDescription(
final HelperTriggerType helperTriggerType) {
- String description;
+ String? description;
switch (helperTriggerType) {
case HelperTriggerType.ON_SCREEN_VISIT:
description = 'On screen visit';
diff --git a/lib/src/database/entity/helper/helper_trigger_type.g.dart b/lib/src/database/entity/helper/helper_trigger_type.g.dart
index a581f7db..6b2fad82 100644
--- a/lib/src/database/entity/helper/helper_trigger_type.g.dart
+++ b/lib/src/database/entity/helper/helper_trigger_type.g.dart
@@ -18,7 +18,7 @@ class HelperTriggerTypeAdapter extends TypeAdapter {
case 1:
return HelperTriggerType.ON_NEW_UPDATE;
default:
- return null;
+ return HelperTriggerType.ON_SCREEN_VISIT;
}
}
diff --git a/lib/src/database/entity/helper/helper_type.dart b/lib/src/database/entity/helper/helper_type.dart
index bff2c4a4..6c18b91e 100644
--- a/lib/src/database/entity/helper/helper_type.dart
+++ b/lib/src/database/entity/helper/helper_type.dart
@@ -18,7 +18,7 @@ enum HelperType {
UPDATE_HELPER,
}
-HelperType getHelperType(final String value) {
+HelperType getHelperType(final String? value) {
return HelperType.values
.firstWhere((element) => element.toString().split('.')[1] == value);
}
@@ -27,8 +27,8 @@ String helperTypeToString(final HelperType helperType) {
return helperType.toString().split('.')[1];
}
-String helperTypeToAsset(final HelperType helperType) {
- String asset;
+String? helperTypeToAsset(final HelperType? helperType) {
+ String? asset;
switch (helperType) {
case HelperType.HELPER_FULL_SCREEN:
asset = 'helper_type_fullscreen.png';
@@ -47,8 +47,8 @@ String helperTypeToAsset(final HelperType helperType) {
return asset;
}
-String getHelperTypeDescription(final HelperType helperType) {
- String description;
+String? getHelperTypeDescription(final HelperType? helperType) {
+ String? description;
switch (helperType) {
case HelperType.HELPER_FULL_SCREEN:
description = 'Fullscreen';
diff --git a/lib/src/database/entity/helper/helper_type.g.dart b/lib/src/database/entity/helper/helper_type.g.dart
index 2a726740..bad72ab6 100644
--- a/lib/src/database/entity/helper/helper_type.g.dart
+++ b/lib/src/database/entity/helper/helper_type.g.dart
@@ -22,7 +22,7 @@ class HelperTypeAdapter extends TypeAdapter {
case 3:
return HelperType.UPDATE_HELPER;
default:
- return null;
+ return HelperType.HELPER_FULL_SCREEN;
}
}
diff --git a/lib/src/database/entity/helper/schema_entity.dart b/lib/src/database/entity/helper/schema_entity.dart
index 98855773..9831ba63 100644
--- a/lib/src/database/entity/helper/schema_entity.dart
+++ b/lib/src/database/entity/helper/schema_entity.dart
@@ -8,13 +8,13 @@ part 'schema_entity.g.dart';
class SchemaEntity {
@HiveField(0)
- String projectId;
+ String? projectId;
@HiveField(1)
- List groups;
+ List? groups;
@HiveField(2)
- int schemaVersion;
+ int? schemaVersion;
SchemaEntity({this.projectId, this.groups, this.schemaVersion});
}
\ No newline at end of file
diff --git a/lib/src/database/entity/helper/schema_entity.g.dart b/lib/src/database/entity/helper/schema_entity.g.dart
index ace51c59..0089f4a1 100644
--- a/lib/src/database/entity/helper/schema_entity.g.dart
+++ b/lib/src/database/entity/helper/schema_entity.g.dart
@@ -17,9 +17,9 @@ class SchemaEntityAdapter extends TypeAdapter {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return SchemaEntity(
- projectId: fields[0] as String,
- groups: (fields[1] as List)?.cast(),
- schemaVersion: fields[2] as int,
+ projectId: fields[0] as String?,
+ groups: (fields[1] as List?)?.cast(),
+ schemaVersion: fields[2] as int?,
);
}
diff --git a/lib/src/database/entity/in_app_user_entity.dart b/lib/src/database/entity/in_app_user_entity.dart
index 1947455c..3b2da1bb 100644
--- a/lib/src/database/entity/in_app_user_entity.dart
+++ b/lib/src/database/entity/in_app_user_entity.dart
@@ -1,8 +1,17 @@
+import 'package:hive/hive.dart';
+
+part 'in_app_user_entity.g.dart';
+
+@HiveType(typeId: 12)
class InAppUserEntity {
- String id;
- String inAppId;
- bool disabledHelpers;
- bool anonymous;
+ @HiveField(0)
+ String? id;
+ @HiveField(1)
+ String? inAppId;
+ @HiveField(2)
+ bool? disabledHelpers;
+ @HiveField(3)
+ bool? anonymous;
InAppUserEntity(
{this.id, this.inAppId, this.disabledHelpers, this.anonymous});
diff --git a/lib/src/database/entity/in_app_user_entity.g.dart b/lib/src/database/entity/in_app_user_entity.g.dart
new file mode 100644
index 00000000..9bdee99a
--- /dev/null
+++ b/lib/src/database/entity/in_app_user_entity.g.dart
@@ -0,0 +1,50 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'in_app_user_entity.dart';
+
+// **************************************************************************
+// TypeAdapterGenerator
+// **************************************************************************
+
+class InAppUserEntityAdapter extends TypeAdapter {
+ @override
+ final int typeId = 12;
+
+ @override
+ InAppUserEntity read(BinaryReader reader) {
+ final numOfFields = reader.readByte();
+ final fields = {
+ for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
+ };
+ return InAppUserEntity(
+ id: fields[0] as String?,
+ inAppId: fields[1] as String?,
+ disabledHelpers: fields[2] as bool?,
+ anonymous: fields[3] as bool?,
+ );
+ }
+
+ @override
+ void write(BinaryWriter writer, InAppUserEntity obj) {
+ writer
+ ..writeByte(4)
+ ..writeByte(0)
+ ..write(obj.id)
+ ..writeByte(1)
+ ..write(obj.inAppId)
+ ..writeByte(2)
+ ..write(obj.disabledHelpers)
+ ..writeByte(3)
+ ..write(obj.anonymous);
+ }
+
+ @override
+ int get hashCode => typeId.hashCode;
+
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ other is InAppUserEntityAdapter &&
+ runtimeType == other.runtimeType &&
+ typeId == other.typeId;
+}
diff --git a/lib/src/database/entity/page_entity.dart b/lib/src/database/entity/page_entity.dart
index da7be535..cec72abe 100644
--- a/lib/src/database/entity/page_entity.dart
+++ b/lib/src/database/entity/page_entity.dart
@@ -6,16 +6,16 @@ part 'page_entity.g.dart';
class PageEntity {
@HiveField(0)
- String id;
+ String? id;
@HiveField(1)
- DateTime creationDate;
+ DateTime? creationDate;
@HiveField(2)
- DateTime lastUpdateDate;
+ DateTime? lastUpdateDate;
@HiveField(3)
- String route;
+ String? route;
PageEntity({
this.id,
@@ -26,8 +26,8 @@ class PageEntity {
Map toJson() => {
'id': id ?? "",
- 'creationDate': creationDate != null ? creationDate.toIso8601String() : null,
- 'lastUpdateDate': lastUpdateDate != null ? lastUpdateDate.toIso8601String() : null,
+ 'creationDate': creationDate != null ? creationDate!.toIso8601String() : null,
+ 'lastUpdateDate': lastUpdateDate != null ? lastUpdateDate!.toIso8601String() : null,
'route': route
};
}
diff --git a/lib/src/database/entity/page_entity.g.dart b/lib/src/database/entity/page_entity.g.dart
index 09ff1dfa..fd8d1615 100644
--- a/lib/src/database/entity/page_entity.g.dart
+++ b/lib/src/database/entity/page_entity.g.dart
@@ -17,10 +17,10 @@ class PageEntityAdapter extends TypeAdapter {
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return PageEntity(
- id: fields[0] as String,
- creationDate: fields[1] as DateTime,
- lastUpdateDate: fields[2] as DateTime,
- route: fields[3] as String,
+ id: fields[0] as String?,
+ creationDate: fields[1] as DateTime?,
+ lastUpdateDate: fields[2] as DateTime?,
+ route: fields[3] as String?,
);
}
diff --git a/lib/src/database/entity/page_user_visit_entity.dart b/lib/src/database/entity/page_user_visit_entity.dart
index 092b5b71..95d6a10f 100644
--- a/lib/src/database/entity/page_user_visit_entity.dart
+++ b/lib/src/database/entity/page_user_visit_entity.dart
@@ -7,20 +7,20 @@ part 'page_user_visit_entity.g.dart';
class HelperGroupUserVisitEntity {
@HiveField(0)
- String pageId;
+ String? pageId;
@HiveField(1)
- String helperGroupId;
+ String? helperGroupId;
@HiveField(2)
- DateTime visitDate;
+ DateTime? visitDate;
@HiveField(3)
- String visitVersion;
+ String? visitVersion;
HelperGroupUserVisitEntity({
- @required this.pageId,
- @required this.helperGroupId,
- @required this.visitDate,
- @required this.visitVersion});
+ required this.pageId,
+ required this.helperGroupId,
+ required this.visitDate,
+ required this.visitVersion});
}
\ No newline at end of file
diff --git a/lib/src/database/entity/page_user_visit_entity.g.dart b/lib/src/database/entity/page_user_visit_entity.g.dart
index e0508961..baf0148d 100644
--- a/lib/src/database/entity/page_user_visit_entity.g.dart
+++ b/lib/src/database/entity/page_user_visit_entity.g.dart
@@ -18,10 +18,10 @@ class HelperGroupUserVisitEntityAdapter
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return HelperGroupUserVisitEntity(
- pageId: fields[0] as String,
- helperGroupId: fields[1] as String,
- visitDate: fields[2] as DateTime,
- visitVersion: fields[3] as String,
+ pageId: fields[0] as String?,
+ helperGroupId: fields[1] as String?,
+ visitDate: fields[2] as DateTime?,
+ visitVersion: fields[3] as String?,
);
}
diff --git a/lib/src/database/entity/pageable.dart b/lib/src/database/entity/pageable.dart
index 6ca8adc5..e21c6770 100644
--- a/lib/src/database/entity/pageable.dart
+++ b/lib/src/database/entity/pageable.dart
@@ -1,13 +1,13 @@
class Pageable {
- int pageNumber;
- int offset;
- int pageSize;
- int totalPages;
- int totalElements;
- int numberOfElements;
- bool last;
- bool first;
- List entities;
+ int? pageNumber;
+ int? offset;
+ int? pageSize;
+ int? totalPages;
+ int? totalElements;
+ int? numberOfElements;
+ bool? last;
+ bool? first;
+ List? entities;
Pageable({
this.pageNumber,
diff --git a/lib/src/database/entity/version_entity.dart b/lib/src/database/entity/version_entity.dart
index e8ed2c00..d9f01ecc 100644
--- a/lib/src/database/entity/version_entity.dart
+++ b/lib/src/database/entity/version_entity.dart
@@ -1,7 +1,7 @@
/// User Application version
class VersionEntity {
- int id;
- String name;
+ int? id;
+ String? name;
VersionEntity({this.id, this.name});
diff --git a/lib/src/database/hive_client.dart b/lib/src/database/hive_client.dart
index f79eb056..d4610c39 100644
--- a/lib/src/database/hive_client.dart
+++ b/lib/src/database/hive_client.dart
@@ -2,13 +2,13 @@
import 'package:flutter/cupertino.dart';
import 'package:hive/hive.dart';
import 'package:pal/src/database/entity/helper/helper_trigger_type.dart';
+import 'package:pal/src/database/entity/in_app_user_entity.dart';
import 'entity/helper/helper_entity.dart';
import 'entity/helper/helper_group_entity.dart';
import 'entity/helper/helper_type.dart';
import 'entity/helper/schema_entity.dart';
import 'entity/page_user_visit_entity.dart';
import 'entity/page_entity.dart';
-import 'package:hive_flutter/hive_flutter.dart';
typedef Future> LocalDbOpener();
@@ -22,7 +22,6 @@ class HiveClient {
@visibleForTesting
init() async {
- await Hive.initFlutter();
initAdapters();
}
@@ -34,17 +33,18 @@ class HiveClient {
@visibleForTesting
initAdapters() {
- Hive.registerAdapter(SchemaEntityAdapter());
- Hive.registerAdapter(HelperGroupEntityAdapter());
- Hive.registerAdapter(HelperEntityAdapter());
- Hive.registerAdapter(PageEntityAdapter());
- Hive.registerAdapter(HelperGroupUserVisitEntityAdapter());
- Hive.registerAdapter(HelperTypeAdapter());
- Hive.registerAdapter(HelperTriggerTypeAdapter());
- Hive.registerAdapter(HelperTextEntityAdapter());
- Hive.registerAdapter(HelperImageEntityAdapter());
- Hive.registerAdapter(HelperBorderEntityAdapter());
- Hive.registerAdapter(HelperBoxEntityAdapter());
+ Hive.registerAdapter(SchemaEntityAdapter(), override: true);
+ Hive.registerAdapter(HelperGroupEntityAdapter(), override: true);
+ Hive.registerAdapter(HelperEntityAdapter(), override: true);
+ Hive.registerAdapter(PageEntityAdapter(), override: true);
+ Hive.registerAdapter(HelperGroupUserVisitEntityAdapter(), override: true);
+ Hive.registerAdapter(HelperTypeAdapter(), override: true);
+ Hive.registerAdapter(HelperTriggerTypeAdapter(), override: true);
+ Hive.registerAdapter(HelperTextEntityAdapter(), override: true);
+ Hive.registerAdapter(HelperImageEntityAdapter(), override: true);
+ Hive.registerAdapter(HelperBorderEntityAdapter(), override: true);
+ Hive.registerAdapter(HelperBoxEntityAdapter(), override: true);
+ Hive.registerAdapter(InAppUserEntityAdapter(), override: true);
}
LocalDbOpener get openSchemaBox =>
@@ -53,6 +53,9 @@ class HiveClient {
LocalDbOpener get openVisitsBox =>
() => Hive.openBox('visits');
+ LocalDbOpener get openInAppUserBox =>
+ () => Hive.openBox('inAppUser');
+
close() => Hive.close();
}
\ No newline at end of file
diff --git a/lib/src/database/repository/base_repository.dart b/lib/src/database/repository/base_repository.dart
index a8fa780c..dcb20c0c 100644
--- a/lib/src/database/repository/base_repository.dart
+++ b/lib/src/database/repository/base_repository.dart
@@ -3,5 +3,5 @@ import 'package:pal/src/services/http_client/base_client.dart';
class BaseHttpRepository {
final HttpClient httpClient;
- const BaseHttpRepository({this.httpClient});
+ const BaseHttpRepository({required this.httpClient});
}
diff --git a/lib/src/database/repository/client/helper_repository.dart b/lib/src/database/repository/client/helper_repository.dart
index 7814a228..a33022f5 100644
--- a/lib/src/database/repository/client/helper_repository.dart
+++ b/lib/src/database/repository/client/helper_repository.dart
@@ -11,10 +11,10 @@ class ClientHelperRepository extends BaseHttpRepository {
final EntityAdapter.HelperEntityAdapter _adapter = EntityAdapter.HelperEntityAdapter();
- ClientHelperRepository({@required HttpClient httpClient})
+ ClientHelperRepository({required HttpClient httpClient})
: super(httpClient: httpClient);
- Future> getAllHelpers({final int version}) {
+ Future> getAllHelpers({final int? version}) {
throw "not implemented yet";
}
diff --git a/lib/src/database/repository/client/page_user_visit_repository.dart b/lib/src/database/repository/client/page_user_visit_repository.dart
index 6c5226b9..bd517208 100644
--- a/lib/src/database/repository/client/page_user_visit_repository.dart
+++ b/lib/src/database/repository/client/page_user_visit_repository.dart
@@ -1,7 +1,6 @@
import 'dart:convert';
-import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:pal/src/database/adapter/helper_group_visit_entity_adapter.dart' as Adapter;
import 'package:pal/src/database/entity/helper/helper_entity.dart';
@@ -14,16 +13,16 @@ import '../base_repository.dart';
abstract class HelperGroupUserVisitRepository {
- Future> get(String userId, String minAppVersion);
+ Future> get(String? userId, String? minAppVersion);
Future saveAll(List visits);
Future add(HelperGroupUserVisitEntity visit, {
- bool isLast,
- bool feedback,
- String inAppUserId,
- HelperEntity helper,
- String languageCode
+ required bool isLast,
+ required bool feedback,
+ required String inAppUserId,
+ required String languageCode,
+ required HelperEntity helper
});
Future clear();
@@ -34,11 +33,11 @@ class HelperGroupUserVisitHttpRepository extends BaseHttpRepository implements H
Adapter.HelperGroupUserVisitEntityAdapter _adapter = Adapter.HelperGroupUserVisitEntityAdapter();
- HelperGroupUserVisitHttpRepository({@required HttpClient httpClient})
+ HelperGroupUserVisitHttpRepository({required HttpClient httpClient})
: super(httpClient: httpClient);
- Future> get(String userId, String minAppVersion) async {
+ Future> get(String? userId, String? minAppVersion) async {
final Response response = await this
.httpClient
.get(Uri.parse('pal-analytic/users/$userId/groups'));
@@ -58,11 +57,11 @@ class HelperGroupUserVisitHttpRepository extends BaseHttpRepository implements H
@override
Future add(HelperGroupUserVisitEntity visit,
{
- @required bool isLast,
- @required bool feedback,
- @required String inAppUserId,
- @required String languageCode,
- @required HelperEntity helper
+ required bool isLast,
+ required bool feedback,
+ required String inAppUserId,
+ required String languageCode,
+ required HelperEntity helper
}) async {
var url = Uri.parse('pal-analytic/users/$inAppUserId/groups/${visit.helperGroupId}/helpers/${helper.id}');
var body = jsonEncode({
@@ -70,7 +69,7 @@ class HelperGroupUserVisitHttpRepository extends BaseHttpRepository implements H
'isLast': isLast,
'language': languageCode
});
- return httpClient.post(url, body: body, headers: {"inAppUserId": inAppUserId});
+ await httpClient.post(url, body: body, headers: {"inAppUserId": inAppUserId});
}
}
@@ -79,10 +78,10 @@ class HelperGroupUserVisitLocalRepository implements HelperGroupUserVisitReposit
LocalDbOpener _hiveBoxOpener;
- HelperGroupUserVisitLocalRepository({@required LocalDbOpener hiveBoxOpener})
+ HelperGroupUserVisitLocalRepository({required LocalDbOpener hiveBoxOpener})
: _hiveBoxOpener = hiveBoxOpener;
- Future> get(String userId, String minAppVersion)
+ Future> get(String? userId, String? minAppVersion)
=> _hiveBoxOpener().then((res) => res.values.toList());
@override
@@ -94,11 +93,11 @@ class HelperGroupUserVisitLocalRepository implements HelperGroupUserVisitReposit
@override
Future add(HelperGroupUserVisitEntity visit, {
- bool isLast,
- bool feedback,
- String inAppUserId,
- HelperEntity helper,
- String languageCode,
+ bool? isLast,
+ bool? feedback,
+ String? inAppUserId,
+ HelperEntity? helper,
+ String? languageCode,
}) => _hiveBoxOpener().then((res) => res.add(visit));
}
\ No newline at end of file
diff --git a/lib/src/database/repository/client/schema_repository.dart b/lib/src/database/repository/client/schema_repository.dart
index e6927723..fc7f23ea 100644
--- a/lib/src/database/repository/client/schema_repository.dart
+++ b/lib/src/database/repository/client/schema_repository.dart
@@ -15,7 +15,7 @@ abstract class ClientSchemaRepository {
/// if [schemaVersion] is provided and repository contains a lower or equal version returns nothing
/// if [language] is null, returns the default language
/// if [appVersion] must be provided, current application version in user pubspec.yml
- Future get({int schemaVersion, String language, String appVersion});
+ Future get({int? schemaVersion, String? language, String? appVersion});
}
@@ -24,11 +24,11 @@ class ClientSchemaRemoteRepository extends BaseHttpRepository implements ClientS
GenericEntityAdapter _adapter = Adapter.SchemaEntityAdapter();
- ClientSchemaRemoteRepository({@required HttpClient httpClient})
+ ClientSchemaRemoteRepository({required HttpClient httpClient})
: super(httpClient: httpClient);
@override
- Future get({int schemaVersion, String language, @required String appVersion}) async {
+ Future get({int? schemaVersion, String? language, String? appVersion}) async {
final Response response = await this
.httpClient
.get(Uri.parse('pal-business/client/schema'), headers: {
@@ -46,27 +46,27 @@ class ClientSchemaRemoteRepository extends BaseHttpRepository implements ClientS
class ClientSchemaLocalRepository implements ClientSchemaRepository {
- final LocalDbOpener _hiveBoxOpener;
+ final LocalDbOpener? _hiveBoxOpener;
- ClientSchemaLocalRepository({ LocalDbOpener hiveBoxOpener})
+ ClientSchemaLocalRepository({ LocalDbOpener? hiveBoxOpener})
: this._hiveBoxOpener = hiveBoxOpener;
@override
- Future get({int schemaVersion, String language, String appVersion}) async {
- var _hiveBox = await _hiveBoxOpener();
+ Future get({int? schemaVersion, String? language, String? appVersion}) async {
+ var _hiveBox = await _hiveBoxOpener!();
if(_hiveBox.isEmpty)
return null;
return _hiveBox.values.first;
}
Future save(SchemaEntity schema) async {
- var _hiveBox = await _hiveBoxOpener();
+ var _hiveBox = await _hiveBoxOpener!();
await _hiveBox.clear();
await _hiveBox.add(schema);
}
Future clear() async {
- var _hiveBox = await _hiveBoxOpener();
+ var _hiveBox = await _hiveBoxOpener!();
await _hiveBox.clear();
}
diff --git a/lib/src/database/repository/editor/helper_editor_repository.dart b/lib/src/database/repository/editor/helper_editor_repository.dart
index ba0a7b34..9eb6e3d0 100644
--- a/lib/src/database/repository/editor/helper_editor_repository.dart
+++ b/lib/src/database/repository/editor/helper_editor_repository.dart
@@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:io';
-import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:pal/src/database/adapter/helper_entity_adapter.dart'
as EntityAdapter;
@@ -15,31 +14,31 @@ class EditorHelperRepository extends BaseHttpRepository {
EntityAdapter.HelperEntityAdapter();
EditorHelperRepository({
- @required HttpClient httpClient,
+ required HttpClient httpClient,
}) : super(httpClient: httpClient);
- Future createHelper(final String pageId, final String groupId,
+ Future createHelper(final String? pageId, final String? groupId,
final HelperEntity createHelper) async {
final payload = jsonEncode(createHelper);
final Response response = await this.httpClient.post(
Uri.parse('pal-business/editor/groups/$groupId/helpers'),
body: payload,
);
- if (response == null || response.body == null)
+ if (response.body.isEmpty)
throw new UnknownHttpError("NO_RESULT");
return this._adapter.parse(response.body);
}
- Future updateHelper(
- final String pageId,
+ Future updateHelper(
+ final String? pageId,
final HelperEntity updatedHelper,
) async {
final payload = jsonEncode(updatedHelper);
final Response response = await this.httpClient.put(
- Uri.parse('pal-business/editor/helpers/${updatedHelper?.id}'),
+ Uri.parse('pal-business/editor/helpers/${updatedHelper.id}'),
body: payload);
- if (response == null || response.body == null)
- throw new UnknownHttpError('NO_RESULT');
+ // if (response.body.isEmpty)
+ // throw new UnknownHttpError('NO_RESULT');
return response.body.length == 0
? null
: this._adapter.parse(response.body);
@@ -52,7 +51,7 @@ class EditorHelperRepository extends BaseHttpRepository {
return this._adapter.parsePage(response.body);
}
- Future> getGroupHelpers(String groupId) async {
+ Future> getGroupHelpers(String? groupId) async {
final Response response =
await this.httpClient.get(Uri.parse('pal-business/editor/groups/$groupId/helpers'));
return this._adapter.parseArray(response.body);
@@ -76,7 +75,7 @@ class EditorHelperRepository extends BaseHttpRepository {
);
}
- Future getHelper(String helperId) async {
+ Future