Blurred Transparent Background Flutter for Windows

Поделиться
HTML-код
  • Опубликовано: 17 окт 2024

Комментарии • 4

  • @Pmuelina
    @Pmuelina 2 месяца назад +1

    Perfect 👏🏻

  • @vampi3037
    @vampi3037 2 месяца назад +1

    Great! can you do the same for Flutter Web?

  • @mahdinaghikhani
    @mahdinaghikhani  2 месяца назад

    1-
    #include
    #include
    #include
    #include
    #include "flutter_window.h"
    #include "utils.h"
    źź
    2-
    enum ACCENT_STATE {
    ACCENT_ENABLE_BLURBEHIND = 3,
    };
    struct ACCENT_POLICY {
    ACCENT_STATE AccentState;
    DWORD AccentFlags;
    DWORD GradientColor;
    DWORD AnimationId;
    };
    struct WINDOWCOMPOSITIONATTRIBDATA {
    int Attrib;
    PVOID pvData;
    SIZE_T cbData;
    };
    typedef BOOL(WINAPI *pfnSetWindowCompositionAttribute)(HWND, WINDOWCOMPOSITIONATTRIBDATA *);
    void EnableBlur(HWND hwnd) {
    HMODULE hUser = GetModuleHandle(L"user32.dll");
    if (hUser) {
    pfnSetWindowCompositionAttribute SetWindowCompositionAttribute =
    (pfnSetWindowCompositionAttribute)GetProcAddress(hUser, "SetWindowCompositionAttribute");
    if (SetWindowCompositionAttribute) {
    ACCENT_POLICY accent = {ACCENT_ENABLE_BLURBEHIND, 0, 0, 0};
    WINDOWCOMPOSITIONATTRIBDATA data = {19, &accent, sizeof(accent)};
    SetWindowCompositionAttribute(hwnd, &data);
    }
    }
    }
    3-
    HWND hwnd = window.GetHandle();
    EnableBlur(hwnd);