This PR adds `FlutterWindowMetricsEvent.viewId` to the embedder API. This PR only tests the ability to send metrics event for the implicit view. Once multiple views can be added via embedder API, we should test the ability to send different IDs. Part of https://github.com/flutter/flutter/issues/144806 Part of https://github.com/flutter/flutter/issues/142845 ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I signed the [CLA]. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
Flutter Embedder Engine GLFW Example
Description
This is an example of how to use Flutter Engine Embedder in order to get a Flutter project rendering in a new host environment. The intended audience is people who need to support host environment other than the ones already provided by Flutter. This is an advanced topic and not intended for beginners.
In this example we are demonstrating rendering a Flutter project inside of the GUI library GLFW. For more information about using the embedder you can read the wiki article Custom Flutter Engine Embedders.
Running Instructions
The following example was tested on MacOSX but with a bit of tweaking should be able to run on other *nix platforms and Windows.
The example has the following dependencies:
- GLFW - This can be installed with Homebrew -
brew install glfw - CMake - This can be installed with Homebrew -
brew install cmake - Flutter - This can be installed from the Flutter webpage
- Flutter Engine - This can be built or downloaded, see Custom Flutter Engine Embedders for more information.
In order to build and run the example you should be able to go into this directory and run
./run.sh.
Troubleshooting
There are a few things you might have to tweak in order to get your build working:
- Flutter Engine Location - Inside the
CMakeList.txtfile you will see that it is set up to search for the header and library for the Flutter Engine in specific locations, those might not be the location of your Flutter Engine. - Pixel Ratio - If the project runs but is drawing at the wrong scale you may have to tweak the
kPixelRatiovariable inFlutterEmbedderGLFW.ccfile. - GLFW Location - Inside the
CMakeLists.txtwe are searching for the GLFW library, if CMake can't find it you may have to edit that.