flutter_window.h 928 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef RUNNER_FLUTTER_WINDOW_H_
  2. #define RUNNER_FLUTTER_WINDOW_H_
  3. #include <flutter/dart_project.h>
  4. #include <flutter/flutter_view_controller.h>
  5. #include <memory>
  6. #include "win32_window.h"
  7. // A window that does nothing but host a Flutter view.
  8. class FlutterWindow : public Win32Window {
  9. public:
  10. // Creates a new FlutterWindow hosting a Flutter view running |project|.
  11. explicit FlutterWindow(const flutter::DartProject& project);
  12. virtual ~FlutterWindow();
  13. protected:
  14. // Win32Window:
  15. bool OnCreate() override;
  16. void OnDestroy() override;
  17. LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
  18. LPARAM const lparam) noexcept override;
  19. private:
  20. // The project to run.
  21. flutter::DartProject project_;
  22. // The Flutter instance hosted by this window.
  23. std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
  24. };
  25. #endif // RUNNER_FLUTTER_WINDOW_H_