@@ -37,6 +37,7 @@ class WindowManager
3737
3838 bool is_frameless = false ;
3939 std::string title_bar_style = " default" ;
40+ double opacity = 1 ;
4041
4142 // The minimum size set by the platform channel.
4243 POINT minimum_size = {0 , 0 };
@@ -80,6 +81,8 @@ class WindowManager
8081 void WindowManager::SetSkipTaskbar (const flutter::EncodableMap &args);
8182 bool WindowManager::HasShadow ();
8283 void WindowManager::SetHasShadow (const flutter::EncodableMap &args);
84+ double WindowManager::GetOpacity ();
85+ void WindowManager::SetOpacity (const flutter::EncodableMap &args);
8386 void WindowManager::StartDragging ();
8487
8588 private:
@@ -541,6 +544,20 @@ void WindowManager::SetSkipTaskbar(const flutter::EncodableMap &args)
541544 }
542545}
543546
547+ double WindowManager::GetOpacity ()
548+ {
549+ return this ->opacity ;
550+ }
551+
552+ void WindowManager::SetOpacity (const flutter::EncodableMap &args)
553+ {
554+ this ->opacity = std::get<double >(args.at (flutter::EncodableValue (" opacity" )));
555+ HWND hWnd = GetMainWindow ();
556+ long gwlExStyle = GetWindowLong (hWnd, GWL_EXSTYLE);
557+ SetWindowLong (hWnd, GWL_EXSTYLE, gwlExStyle | WS_EX_LAYERED);
558+ SetLayeredWindowAttributes (hWnd, 0 , static_cast <int8_t >(255 * this ->opacity ), 0x02 );
559+ }
560+
544561void WindowManager::StartDragging ()
545562{
546563 ReleaseCapture ();
0 commit comments