Advertisement
FlyFar

flutter_window.h

Jul 25th, 2023
578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #ifndef RUNNER_FLUTTER_WINDOW_H_
  2. #define RUNNER_FLUTTER_WINDOW_H_
  3.  
  4. #include <flutter/dart_project.h>
  5. #include <flutter/flutter_view_controller.h>
  6.  
  7. #include <memory>
  8.  
  9. #include "win32_window.h"
  10.  
  11. // A window that does nothing but host a Flutter view.
  12. class FlutterWindow : public Win32Window {
  13.  public:
  14.   // Creates a new FlutterWindow hosting a Flutter view running |project|.
  15.   explicit FlutterWindow(const flutter::DartProject& project);
  16.   virtual ~FlutterWindow();
  17.  
  18.  protected:
  19.   // Win32Window:
  20.   bool OnCreate() override;
  21.   void OnDestroy() override;
  22.   LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
  23.                          LPARAM const lparam) noexcept override;
  24.  
  25.  private:
  26.   // The project to run.
  27.   flutter::DartProject project_;
  28.  
  29.   // The Flutter instance hosted by this window.
  30.   std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
  31. };
  32.  
  33. #endif  // RUNNER_FLUTTER_WINDOW_H_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement