feat: implement retreiving widgets
- display a bottom sheet with widgets - open widgets in a browser - fixes in .gitignore - Windows UWP build files Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
BIN
winuwp/runner_uwp/Assets/LargeTile.scale-100.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
winuwp/runner_uwp/Assets/LargeTile.scale-125.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
winuwp/runner_uwp/Assets/LargeTile.scale-150.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
winuwp/runner_uwp/Assets/LargeTile.scale-200.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
winuwp/runner_uwp/Assets/LargeTile.scale-400.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
winuwp/runner_uwp/Assets/LockScreenLogo.scale-200.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
winuwp/runner_uwp/Assets/SmallTile.scale-100.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
winuwp/runner_uwp/Assets/SmallTile.scale-125.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
winuwp/runner_uwp/Assets/SmallTile.scale-150.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
winuwp/runner_uwp/Assets/SmallTile.scale-200.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
winuwp/runner_uwp/Assets/SmallTile.scale-400.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
winuwp/runner_uwp/Assets/SplashScreen.scale-100.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
winuwp/runner_uwp/Assets/SplashScreen.scale-125.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
winuwp/runner_uwp/Assets/SplashScreen.scale-150.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
winuwp/runner_uwp/Assets/SplashScreen.scale-200.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
winuwp/runner_uwp/Assets/SplashScreen.scale-400.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
winuwp/runner_uwp/Assets/Square150x150Logo.scale-100.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
winuwp/runner_uwp/Assets/Square150x150Logo.scale-125.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
winuwp/runner_uwp/Assets/Square150x150Logo.scale-150.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
winuwp/runner_uwp/Assets/Square150x150Logo.scale-200.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
winuwp/runner_uwp/Assets/Square150x150Logo.scale-400.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 697 B |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.scale-100.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.scale-125.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.scale-150.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.scale-200.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.scale-400.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.targetsize-16.png
Normal file
|
After Width: | Height: | Size: 479 B |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.targetsize-24.png
Normal file
|
After Width: | Height: | Size: 788 B |
|
After Width: | Height: | Size: 1.2 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.targetsize-256.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.targetsize-32.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
winuwp/runner_uwp/Assets/Square44x44Logo.targetsize-48.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
winuwp/runner_uwp/Assets/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
winuwp/runner_uwp/Assets/StoreLogo.scale-100.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
winuwp/runner_uwp/Assets/StoreLogo.scale-125.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
winuwp/runner_uwp/Assets/StoreLogo.scale-150.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
winuwp/runner_uwp/Assets/StoreLogo.scale-200.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
winuwp/runner_uwp/Assets/StoreLogo.scale-400.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
winuwp/runner_uwp/Assets/Wide310x150Logo.scale-200.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
winuwp/runner_uwp/Assets/WideTile.scale-100.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
winuwp/runner_uwp/Assets/WideTile.scale-125.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
winuwp/runner_uwp/Assets/WideTile.scale-150.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
winuwp/runner_uwp/Assets/WideTile.scale-200.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
winuwp/runner_uwp/Assets/WideTile.scale-400.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
141
winuwp/runner_uwp/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
cmake_minimum_required (VERSION 3.8)
|
||||
set(CMAKE_SYSTEM_NAME WindowsStore)
|
||||
set(CMAKE_SYSTEM_VERSION 10.0)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
|
||||
include(CMakePrintHelpers)
|
||||
|
||||
project (runner LANGUAGES CXX)
|
||||
|
||||
# UWP tile and icon assets.
|
||||
set(ASSET_FILES ${ASSET_FILES}
|
||||
Assets/LargeTile.scale-100.png
|
||||
Assets/LargeTile.scale-125.png
|
||||
Assets/LargeTile.scale-150.png
|
||||
Assets/LargeTile.scale-200.png
|
||||
Assets/LargeTile.scale-400.png
|
||||
Assets/LockScreenLogo.scale-200.png
|
||||
Assets/SmallTile.scale-100.png
|
||||
Assets/SmallTile.scale-125.png
|
||||
Assets/SmallTile.scale-150.png
|
||||
Assets/SmallTile.scale-200.png
|
||||
Assets/SmallTile.scale-400.png
|
||||
Assets/SplashScreen.scale-100.png
|
||||
Assets/SplashScreen.scale-125.png
|
||||
Assets/SplashScreen.scale-150.png
|
||||
Assets/SplashScreen.scale-200.png
|
||||
Assets/SplashScreen.scale-400.png
|
||||
Assets/Square44x44Logo.altform-unplated_targetsize-16.png
|
||||
Assets/Square44x44Logo.altform-unplated_targetsize-32.png
|
||||
Assets/Square44x44Logo.altform-unplated_targetsize-48.png
|
||||
Assets/Square44x44Logo.altform-unplated_targetsize-256.png
|
||||
Assets/Square44x44Logo.scale-100.png
|
||||
Assets/Square44x44Logo.scale-125.png
|
||||
Assets/Square44x44Logo.scale-150.png
|
||||
Assets/Square44x44Logo.scale-200.png
|
||||
Assets/Square44x44Logo.scale-400.png
|
||||
Assets/Square44x44Logo.targetsize-16.png
|
||||
Assets/Square44x44Logo.targetsize-24.png
|
||||
Assets/Square44x44Logo.targetsize-24_altform-unplated.png
|
||||
Assets/Square44x44Logo.targetsize-32.png
|
||||
Assets/Square44x44Logo.targetsize-48.png
|
||||
Assets/Square44x44Logo.targetsize-256.png
|
||||
Assets/Square150x150Logo.scale-100.png
|
||||
Assets/Square150x150Logo.scale-125.png
|
||||
Assets/Square150x150Logo.scale-150.png
|
||||
Assets/Square150x150Logo.scale-200.png
|
||||
Assets/Square150x150Logo.scale-400.png
|
||||
Assets/StoreLogo.png
|
||||
Assets/StoreLogo.scale-100.png
|
||||
Assets/StoreLogo.scale-125.png
|
||||
Assets/StoreLogo.scale-150.png
|
||||
Assets/StoreLogo.scale-200.png
|
||||
Assets/StoreLogo.scale-400.png
|
||||
Assets/Wide310x150Logo.scale-200.png
|
||||
Assets/WideTile.scale-100.png
|
||||
Assets/WideTile.scale-125.png
|
||||
Assets/WideTile.scale-150.png
|
||||
Assets/WideTile.scale-200.png
|
||||
Assets/WideTile.scale-400.png
|
||||
)
|
||||
|
||||
# Configure package manifest file.
|
||||
set(APP_MANIFEST_NAME Package.appxmanifest)
|
||||
set(APP_MANIFEST_TARGET_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME})
|
||||
set(SHORT_NAME ${BINARY_NAME})
|
||||
set(PACKAGE_GUID "086F9B60-CB52-4D0B-9B4E-AE891E7859D1")
|
||||
|
||||
configure_file(
|
||||
appxmanifest.in
|
||||
${APP_MANIFEST_TARGET_LOCATION}
|
||||
@ONLY)
|
||||
|
||||
set(CONTENT_FILES ${APP_MANIFEST_TARGET_LOCATION})
|
||||
|
||||
# Configure package content files.
|
||||
set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
|
||||
|
||||
set(RESOURCE_FILES ${ASSET_FILES} ${CONTENT_FILES} Windows_TemporaryKey.pfx)
|
||||
set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
|
||||
set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "Assets")
|
||||
|
||||
set(STRING_FILES Resources.pri)
|
||||
set_property(SOURCE ${STRING_FILES} PROPERTY VS_TOOL_OVERRIDE "PRIResource")
|
||||
|
||||
source_group("Resource Files" FILES ${RESOURCE_FILES} ${CONTENT_FILES} ${STRING_FILES})
|
||||
|
||||
# Configure Flutter assets using tool generated install manifest
|
||||
foreach(ITEM ${INSTALL_MANIFEST_CONTENT})
|
||||
get_filename_component(ITEM_REL ${CMAKE_BINARY_DIR} DIRECTORY)
|
||||
file(RELATIVE_PATH RELPATH ${ITEM_REL} ${ITEM})
|
||||
|
||||
get_filename_component(RELPATH ${RELPATH} DIRECTORY)
|
||||
get_filename_component(ITEMEXT ${ITEM} LAST_EXT)
|
||||
|
||||
if("${ITEMEXT}" STREQUAL ".dll" OR "${ITEMEXT}" STREQUAL ".pdb")
|
||||
string(CONCAT RELPATH "")
|
||||
elseif ("${ITEMEXT}" STREQUAL ".so")
|
||||
file(RELATIVE_PATH RELPATH "${ITEM_REL}/winuwp" ${ITEM})
|
||||
string(REGEX REPLACE "/" "\\\\" RELPATH ${RELPATH})
|
||||
string(CONCAT RELPATH "Assets\\Data")
|
||||
elseif("${ITEMEXT}" STREQUAL ".dat")
|
||||
string(CONCAT RELPATH "Assets\\Data")
|
||||
else()
|
||||
string(REGEX REPLACE "/" "\\\\" RELPATH ${RELPATH})
|
||||
string(CONCAT RELPATH "Assets\\Data\\" ${RELPATH})
|
||||
endif()
|
||||
|
||||
cmake_print_variables(${RELPATH})
|
||||
|
||||
set_property(SOURCE ${ITEM} PROPERTY VS_DEPLOYMENT_CONTENT 1)
|
||||
set_property(SOURCE ${ITEM} PROPERTY VS_DEPLOYMENT_LOCATION ${RELPATH})
|
||||
endforeach()
|
||||
|
||||
# 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
|
||||
main.cpp
|
||||
flutter_frameworkview.cpp
|
||||
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
|
||||
${RESOURCE_FILES}
|
||||
${INSTALL_MANIFEST_CONTENT}
|
||||
)
|
||||
|
||||
# Apply the standard set of build settings. This can be removed for applications
|
||||
# that need different build settings.
|
||||
apply_standard_settings(${BINARY_NAME})
|
||||
|
||||
# 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 WindowsApp flutter flutter_wrapper_app)
|
||||
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)
|
||||
27
winuwp/runner_uwp/CMakeSettings.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug",
|
||||
"generator": "Visual Studio 15 2017 Win64",
|
||||
"configurationType": "Debug",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
},
|
||||
{
|
||||
"name": "Release",
|
||||
"generator": "Visual Studio 15 2017 Win64",
|
||||
"configurationType": "Release",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "",
|
||||
"ctestCommandArgs": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
winuwp/runner_uwp/Windows_TemporaryKey.pfx
Normal file
42
winuwp/runner_uwp/appxmanifest.in
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity Name="@PACKAGE_GUID@" Publisher="CN=CMake Test Cert" Version="1.1.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="@PACKAGE_GUID@" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>@SHORT_NAME@</DisplayName>
|
||||
<PublisherDisplayName>CMake Test Cert</PublisherDisplayName>
|
||||
<Logo>Assets/StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.65535.65535" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="@SHORT_NAME@"
|
||||
Description="@SHORT_NAME@"
|
||||
BackgroundColor="#336699"
|
||||
Square150x150Logo="Assets/Square150x150Logo.png"
|
||||
Square44x44Logo="Assets/Square44x44Logo.png"
|
||||
>
|
||||
<uap:SplashScreen Image="Assets/SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClientServer"/>
|
||||
<Capability Name="internetClient"/>
|
||||
<Capability Name="privateNetworkClientServer"/>
|
||||
<Capability Name="codeGeneration"/></Capabilities>
|
||||
</Package>
|
||||
155
winuwp/runner_uwp/flutter_frameworkview.cpp
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
#include "winrt/Windows.ApplicationModel.Core.h"
|
||||
#include "winrt/Windows.Foundation.h"
|
||||
#include "winrt/Windows.System.Profile.h"
|
||||
#include "winrt/Windows.System.Threading.h"
|
||||
#include "winrt/Windows.UI.Core.h"
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.Graphics.Display.h>
|
||||
#include <winrt/Windows.Storage.h>
|
||||
#include <winrt/Windows.UI.Popups.h>
|
||||
#include <winrt/Windows.UI.ViewManagement.Core.h>
|
||||
#include <winrt/Windows.UI.ViewManagement.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
#include <flutter/flutter_view_controller.h>
|
||||
#include <flutter/flutter_windows.h>
|
||||
#include <flutter/generated_plugin_registrant.h>
|
||||
#include <flutter/plugin_registry.h>
|
||||
|
||||
struct FlutterFrameworkView
|
||||
: winrt::implements<
|
||||
FlutterFrameworkView,
|
||||
winrt::Windows::ApplicationModel::Core::IFrameworkView> {
|
||||
// |winrt::Windows::ApplicationModel::Core::IFrameworkView|
|
||||
void
|
||||
Initialize(winrt::Windows::ApplicationModel::Core::CoreApplicationView const
|
||||
&applicationView) {
|
||||
|
||||
// Layout scaling must be disabled in the appinitialization phase in order
|
||||
// to take effect correctly.
|
||||
if (winrt::Windows::System::Profile::AnalyticsInfo::VersionInfo()
|
||||
.DeviceFamily() == L"Windows.Xbox") {
|
||||
|
||||
bool result = winrt::Windows::UI::ViewManagement::ApplicationViewScaling::
|
||||
TrySetDisableLayoutScaling(true);
|
||||
if (!result) {
|
||||
OutputDebugString(L"Couldn't disable layout scaling");
|
||||
}
|
||||
}
|
||||
|
||||
main_view_ = applicationView;
|
||||
main_view_.Activated({this, &FlutterFrameworkView::OnActivated});
|
||||
}
|
||||
|
||||
// |winrt::Windows::ApplicationModel::Core::IFrameworkView|
|
||||
void Uninitialize() {
|
||||
main_view_.Activated(nullptr);
|
||||
main_view_ = nullptr;
|
||||
}
|
||||
|
||||
// |winrt::Windows::ApplicationModel::Core::IFrameworkView|
|
||||
void Load(winrt::hstring const &) {}
|
||||
|
||||
// |winrt::Windows::ApplicationModel::Core::IFrameworkView|
|
||||
void Run() {
|
||||
winrt::Windows::UI::Core::CoreWindow window =
|
||||
winrt::Windows::UI::Core::CoreWindow::GetForCurrentThread();
|
||||
|
||||
winrt::Windows::UI::Core::CoreDispatcher dispatcher = window.Dispatcher();
|
||||
dispatcher.ProcessEvents(
|
||||
winrt::Windows::UI::Core::CoreProcessEventsOption::ProcessUntilQuit);
|
||||
}
|
||||
|
||||
// |winrt::Windows::ApplicationModel::Core::IFrameworkView|
|
||||
winrt::Windows::Foundation::IAsyncAction
|
||||
SetWindow(winrt::Windows::UI::Core::CoreWindow const &window) {
|
||||
|
||||
// Capture reference to window.
|
||||
window_ = window;
|
||||
|
||||
// Lay out the window's content within the region occupied by the
|
||||
// CoreWindow.
|
||||
auto appView = winrt::Windows::UI::ViewManagement::ApplicationView::
|
||||
GetForCurrentView();
|
||||
|
||||
appView.SetDesiredBoundsMode(winrt::Windows::UI::ViewManagement::
|
||||
ApplicationViewBoundsMode::UseCoreWindow);
|
||||
|
||||
// Configure folder paths.
|
||||
try {
|
||||
winrt::Windows::Storage::StorageFolder folder =
|
||||
winrt::Windows::ApplicationModel::Package::Current()
|
||||
.InstalledLocation();
|
||||
|
||||
winrt::Windows::Storage::StorageFolder assets =
|
||||
co_await folder.GetFolderAsync(L"Assets");
|
||||
winrt::Windows::Storage::StorageFolder data =
|
||||
co_await assets.GetFolderAsync(L"data");
|
||||
winrt::Windows::Storage::StorageFolder flutter_assets =
|
||||
co_await data.GetFolderAsync(L"flutter_assets");
|
||||
winrt::Windows::Storage::StorageFile icu_data =
|
||||
co_await data.GetFileAsync(L"icudtl.dat");
|
||||
|
||||
#if NDEBUG
|
||||
winrt::Windows::Storage::StorageFile aot_data =
|
||||
co_await data.GetFileAsync(L"app.so");
|
||||
#endif
|
||||
|
||||
std::wstring flutter_assets_path{flutter_assets.Path()};
|
||||
std::wstring icu_data_path{icu_data.Path()};
|
||||
std::wstring aot_data_path {
|
||||
#if NDEBUG
|
||||
aot_data.Path()
|
||||
#endif
|
||||
};
|
||||
|
||||
flutter::DartProject project(flutter_assets_path, icu_data_path,
|
||||
aot_data_path);
|
||||
|
||||
// Construct viewcontroller using the Window and project
|
||||
flutter_view_controller_ = std::make_unique<flutter::FlutterViewController>(
|
||||
static_cast<ABI::Windows::ApplicationModel::Core::CoreApplicationView*>(winrt::get_abi(main_view_)),
|
||||
static_cast<ABI::Windows::ApplicationModel::Activation::IActivatedEventArgs*>(winrt::get_abi(launch_args_)),
|
||||
project);
|
||||
|
||||
// If plugins present, register them.
|
||||
RegisterPlugins(flutter_view_controller_.get()->engine());
|
||||
} catch (winrt::hresult_error &err) {
|
||||
winrt::Windows::UI::Popups::MessageDialog md =
|
||||
winrt::Windows::UI::Popups::MessageDialog::MessageDialog(
|
||||
L"There was a problem starting the engine: " + err.message());
|
||||
md.ShowAsync();
|
||||
}
|
||||
}
|
||||
|
||||
void OnActivated(
|
||||
winrt::Windows::ApplicationModel::Core::CoreApplicationView const
|
||||
&applicationView,
|
||||
winrt::Windows::ApplicationModel::Activation::IActivatedEventArgs const
|
||||
&args) {
|
||||
// Activate the application window, making it visible and enabling it to
|
||||
// receive events.
|
||||
applicationView.CoreWindow().Activate();
|
||||
|
||||
// Capture launch args to later pass to Flutter.
|
||||
launch_args_ = args;
|
||||
}
|
||||
|
||||
// Current CoreApplicationView.
|
||||
winrt::Windows::ApplicationModel::Core::CoreApplicationView main_view_{
|
||||
nullptr};
|
||||
|
||||
// Current CoreWindow.
|
||||
winrt::Windows::UI::Core::CoreWindow window_{nullptr};
|
||||
|
||||
// Current FlutterViewController.
|
||||
std::unique_ptr<flutter::FlutterViewController> flutter_view_controller_{
|
||||
nullptr};
|
||||
|
||||
// Launch args that were passed in on activation.
|
||||
winrt::Windows::ApplicationModel::Activation::IActivatedEventArgs
|
||||
launch_args_;
|
||||
};
|
||||
30
winuwp/runner_uwp/main.cpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
#include "winrt/Windows.ApplicationModel.Core.h"
|
||||
#include "winrt/Windows.Foundation.h"
|
||||
#include <winrt/Windows.Foundation.Collections.h>
|
||||
#include <winrt/Windows.UI.ViewManagement.Core.h>
|
||||
#include <winrt/Windows.UI.ViewManagement.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "flutter_frameworkview.cpp"
|
||||
|
||||
struct App
|
||||
: winrt::implements<
|
||||
App, winrt::Windows::ApplicationModel::Core::IFrameworkViewSource> {
|
||||
App() { view_ = winrt::make_self<FlutterFrameworkView>(); }
|
||||
|
||||
// |winrt::Windows::ApplicationModel::Core::IFrameworkViewSource|
|
||||
winrt::Windows::ApplicationModel::Core::IFrameworkView CreateView() {
|
||||
return view_.as<winrt::Windows::ApplicationModel::Core::IFrameworkView>();
|
||||
}
|
||||
|
||||
winrt::com_ptr<FlutterFrameworkView> view_;
|
||||
};
|
||||
|
||||
int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int) {
|
||||
winrt::Windows::ApplicationModel::Core::CoreApplication::Run(
|
||||
winrt::make<App>());
|
||||
}
|
||||