首页
苏兮影视
随笔记
壁纸
更多
直播
时光轴
友联
关于
统计
Search
1
v2ray节点搭建
1,022 阅读
2
软件添加id功能按钮
937 阅读
3
QQ扫码无法登录的解决方案
845 阅读
4
网易云音乐歌单ID获取教程
718 阅读
5
typecho非常有特色的模块
664 阅读
谈天说地
建站源码
经验教程
资源分享
动漫美图
登录
Search
标签搜索
java
rust
flutter
esp32c3
springboot
安卓
linux
vue
dart
设计模式
docker
joe
快捷键
git
fish shell
maven
redis
netty
groovy
js
尽意
累计撰写
112
篇文章
累计收到
39
条评论
首页
栏目
谈天说地
建站源码
经验教程
资源分享
动漫美图
页面
苏兮影视
随笔记
壁纸
直播
时光轴
友联
关于
统计
搜索到
1
篇与
的结果
flutter开发桌面应用实现窗体透明
2024年09月21日
277 阅读
0 评论
1 点赞
2024-09-21
1.使用bitsdojo_window插件:使用命令添加dart pub add bitsdojo_window2.在 windows/runner/main.cpp 中进行窗口透明设置:#include <flutter/dart_project.h> #include <flutter/flutter_view_controller.h> #include <windows.h> #include "flutter_window.h" #include "utils.h" // 添加的代码 #include<bitsdojo_window_windows/bitsdojo_window_plugin.h> auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP); void EnableTransparency(HWND hwnd) { SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); COLORREF colorKey = RGB(255, 255, 255); BYTE alpha = 128; // 设置透明度(0-256) SetLayeredWindowAttributes(hwnd, colorKey, alpha, LWA_ALPHA); } // 到这里结束 int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, _In_ wchar_t *command_line, _In_ int show_command) { // Attach to console when present (e.g., 'flutter run') or create a // new console when running with a debugger. //...省略中间的代码 // 添加的代码 EnableTransparency(window.GetHandle()); // 到这里结束 window.SetQuitOnClose(true); ::MSG msg; while (::GetMessage(&msg, nullptr, 0, 0)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } ::CoUninitialize(); return EXIT_SUCCESS; } 3.设置页面背景为透明:Scaffold( backgroundColor: Colors.transparent, body: Container() )4.实现的效果: