@ -0,0 +1,28 @@ |
||||
# This file configures the analyzer, which statically analyzes Dart code to |
||||
# check for errors, warnings, and lints. |
||||
# |
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled |
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be |
||||
# invoked from the command line by running `flutter analyze`. |
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps, |
||||
# packages, and plugins designed to encourage good coding practices. |
||||
include: package:flutter_lints/flutter.yaml |
||||
|
||||
linter: |
||||
# The lint rules applied to this project can be customized in the |
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` |
||||
# included above or to enable additional rules. A list of all available lints |
||||
# and their documentation is published at https://dart.dev/lints. |
||||
# |
||||
# Instead of disabling a lint rule for the entire project in the |
||||
# section below, it can also be suppressed for a single line of code |
||||
# or a specific dart file by using the `// ignore: name_of_lint` and |
||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file |
||||
# producing the lint. |
||||
rules: |
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule |
||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule |
||||
|
||||
# Additional information about this file can be found at |
||||
# https://dart.dev/guides/language/analysis-options |
@ -1,8 +1,7 @@ |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||
package="com.example.app"> |
||||
<!-- Flutter needs it to communicate with the running application |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<!-- The INTERNET permission is required for development. Specifically, |
||||
the Flutter tool needs it to communicate with the running application |
||||
to allow setting breakpoints, to provide hot reload, etc. |
||||
--> |
||||
<uses-permission android:name="android.permission.INTERNET"/> |
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
||||
</manifest> |
||||
|
@ -1,8 +1,7 @@ |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||
package="com.example.app"> |
||||
<!-- Flutter needs it to communicate with the running application |
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<!-- The INTERNET permission is required for development. Specifically, |
||||
the Flutter tool needs it to communicate with the running application |
||||
to allow setting breakpoints, to provide hot reload, etc. |
||||
--> |
||||
<uses-permission android:name="android.permission.INTERNET"/> |
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> |
||||
</manifest> |
||||
|
@ -1,3 +1,6 @@ |
||||
org.gradle.jvmargs=-Xmx1536M |
||||
android.useAndroidX=true |
||||
android.enableJetifier=true |
||||
android.defaults.buildfeatures.buildconfig=true |
||||
android.nonTransitiveRClass=false |
||||
android.nonFinalResIds=false |
||||
|
@ -1,6 +1,5 @@ |
||||
#Fri Jun 23 08:50:38 CEST 2017 |
||||
distributionBase=GRADLE_USER_HOME |
||||
distributionPath=wrapper/dists |
||||
zipStoreBase=GRADLE_USER_HOME |
||||
zipStorePath=wrapper/dists |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip |
||||
|
@ -1,11 +1,20 @@ |
||||
include ':app' |
||||
pluginManagement { |
||||
def flutterSdkPath = { |
||||
def properties = new Properties() |
||||
file("local.properties").withInputStream { properties.load(it) } |
||||
def flutterSdkPath = properties.getProperty("flutter.sdk") |
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" |
||||
return flutterSdkPath |
||||
} |
||||
settings.ext.flutterSdkPath = flutterSdkPath() |
||||
|
||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties") |
||||
def properties = new Properties() |
||||
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") |
||||
|
||||
assert localPropertiesFile.exists() |
||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } |
||||
plugins { |
||||
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false |
||||
} |
||||
} |
||||
|
||||
def flutterSdkPath = properties.getProperty("flutter.sdk") |
||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" |
||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" |
||||
include ":app" |
||||
|
||||
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" |
||||
|
@ -1,6 +0,0 @@ |
||||
#import <Flutter/Flutter.h> |
||||
#import <UIKit/UIKit.h> |
||||
|
||||
@interface AppDelegate : FlutterAppDelegate |
||||
|
||||
@end |
@ -1,13 +0,0 @@ |
||||
#import "AppDelegate.h" |
||||
#import "GeneratedPluginRegistrant.h" |
||||
|
||||
@implementation AppDelegate |
||||
|
||||
- (BOOL)application:(UIApplication *)application |
||||
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
||||
[GeneratedPluginRegistrant registerWithRegistry:self]; |
||||
// Override point for customization after application launch. |
||||
return [super application:application didFinishLaunchingWithOptions:launchOptions]; |
||||
} |
||||
|
||||
@end |
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 586 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 762 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 1.4 KiB |
@ -1,9 +0,0 @@ |
||||
#import <Flutter/Flutter.h> |
||||
#import <UIKit/UIKit.h> |
||||
#import "AppDelegate.h" |
||||
|
||||
int main(int argc, char* argv[]) { |
||||
@autoreleasepool { |
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
import Flutter |
||||
import UIKit |
||||
import XCTest |
||||
|
||||
class RunnerTests: XCTestCase { |
||||
|
||||
func testExample() { |
||||
// If you add code to the Runner application, consider adding tests here. |
||||
// See https://developer.apple.com/documentation/xctest for more information about using XCTest. |
||||
} |
||||
|
||||
} |
@ -1,3 +1,3 @@ |
||||
class PlatformViewRegistry { |
||||
static void registerViewFactory(String viewId, dynamic cb) {} |
||||
} |
||||
// class PlatformViewRegistry { |
||||
// static void registerViewFactory(String viewId, dynamic cb) {} |
||||
// } |
||||
|
@ -1,7 +1,7 @@ |
||||
import 'dart:ui' if (dart.library.html) 'dart:ui_web' as ui; |
||||
// import 'dart:ui' if (dart.library.html) 'dart:ui_web' as ui; |
||||
|
||||
class PlatformViewRegistry { |
||||
static void registerViewFactory(String viewId, dynamic cb) { |
||||
ui.platformViewRegistry.registerViewFactory(viewId, cb); |
||||
} |
||||
} |
||||
// class PlatformViewRegistry { |
||||
// static void registerViewFactory(String viewId, dynamic cb) { |
||||
// ui.platformViewRegistry.registerViewFactory(viewId, cb); |
||||
// } |
||||
// } |
||||
|
@ -0,0 +1,12 @@ |
||||
import FlutterMacOS |
||||
import Cocoa |
||||
import XCTest |
||||
|
||||
class RunnerTests: XCTestCase { |
||||
|
||||
func testExample() { |
||||
// If you add code to the Runner application, consider adding tests here. |
||||
// See https://developer.apple.com/documentation/xctest for more information about using XCTest. |
||||
} |
||||
|
||||
} |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 20 KiB |
@ -1,18 +1,40 @@ |
||||
cmake_minimum_required(VERSION 3.15) |
||||
cmake_minimum_required(VERSION 3.14) |
||||
project(runner LANGUAGES CXX) |
||||
|
||||
# Define the application target. To change its name, change BINARY_NAME in the |
||||
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer |
||||
# work. |
||||
# |
||||
# Any new source files that you add to the application should be added here. |
||||
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 the standard set of build settings. This can be removed for applications |
||||
# that need different build settings. |
||||
apply_standard_settings(${BINARY_NAME}) |
||||
|
||||
# Add preprocessor definitions for the build version. |
||||
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") |
||||
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") |
||||
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") |
||||
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") |
||||
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") |
||||
|
||||
# Disable Windows macros that collide with C++ standard library functions. |
||||
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") |
||||
|
||||
# Add dependency libraries and include directories. Add any application-specific |
||||
# dependencies here. |
||||
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) |
||||
target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") |
||||
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") |
||||
|
||||
# Run the Flutter tool portions of the build. This must not be removed. |
||||
add_dependencies(${BINARY_NAME} flutter_assemble) |
||||
|
@ -1,66 +0,0 @@ |
||||
#include "run_loop.h" |
||||
|
||||
#include <windows.h> |
||||
|
||||
#include <algorithm> |
||||
|
||||
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<DWORD>(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; |
||||
} |
@ -1,40 +0,0 @@ |
||||
#ifndef RUNNER_RUN_LOOP_H_ |
||||
#define RUNNER_RUN_LOOP_H_ |
||||
|
||||
#include <flutter/flutter_engine.h> |
||||
|
||||
#include <chrono> |
||||
#include <set> |
||||
|
||||
// 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::FlutterEngine*> flutter_instances_; |
||||
}; |
||||
|
||||
#endif // RUNNER_RUN_LOOP_H_
|