New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
无法获取window #11
Comments
Hi, 你可能需要一些初始化才能获取window对象。
可以提供一下你的window的代码吗? |
获取对象相关代码已删除,目前解决方案是通过Android广播机制来传值。 初始化悬浮窗(main.dart中) @pragma("vm:entry-point")
void overlayPlayer() {
runApp(const OverlayApp(
child: OverlayPlayerView(),
));
} @pragma("vm:entry-point")
void overlayDestroyer() {
runApp(const OverlayApp(
child: OverlayDestroyer(),
));
} 显示悬浮窗 await WindowConfig(
entry: "overlayPlayer",
draggable: true,
clickable: true,
focusable: false,
height: (_playerSize * _pxRatio).round(),
width: (_playerSize * _pxRatio).round(),
id: "overlayPlayer",
x: (_screenSize.width - _playerSize * _pxRatio).round(),
y: (_screenSize.height / 2 + 100).round(),
immersion: true,
).to().create(start: true) await WindowConfig(
entry: "overlayDestroyer",
draggable: false,
clickable: false,
focusable: false,
height: (100 * _pxRatio).round(),
width: (_screenSize.width).round(),
y: (_screenSize.height - 100 * _pxRatio).round(),
id: "overlayDestroyer",
immersion: true,
).to().create(start: true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
你好,我的App通过entry-point方式开启悬浮窗,悬浮窗包含在GetMaterialApp中。
在悬浮窗的SchedulerBinding.instance.addPostFrameCallback调用Window.of(context)和FloatwingPlugin().currentWindow都返回null。
调用syncWindows()后再通过windows["xxxID"]可以获取window对象,但不会回调onData。
版本信息
flutter_floatwing: ^0.2.1
Flutter: 3.0.5
The text was updated successfully, but these errors were encountered: