flutter_window.h (928B)
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_