Here are some information about me:
- 🔭 https://zoe.im
- 📫 [email protected]
- 🌎 Hangzhou, China
- ⚡ @wellwellwork
- 🛠️ Kubernetes, Cloud Native
A Flutter plugin that makes it easier to make floating/overlay window for Android with pure Flutter. 一个可以用纯粹的Flutter来开发Android浮动窗口的插件。
License: Other
Here are some information about me:
创建了一个window 然后类似demo里的AssistiveTouch一样 希望能再创建一个新的window
但是在初始化新的window的时候,整个应用的初始又全部重新走了一遍(应用没有重新启动之类的视觉上的变化,是全部相关的日志重新输出了)
然后start之后也没有任何反应
长时间(10分钟)运行之后,launchMainActivity会无法唤起。
i am trying open kiosk mode with overlay window, outisde app. Its for my personal lock app. Its possible with this app?
flutter_floatwing-main\android\src\main\kotlin\im\zoe\labs\flutter_floatwing\FloatwingService.kt: (128, 32): Type mismatch: inferred type is Map<*, >? but Map<, *> was expected
i tried installing the package and i gave it permissions
but i do not know why is Open button non clickable
it seems it always return null
because the window i thinks is never ready
i cloned the package and it did work greatly
but when i set it in a new project that problem occur
am i messing something to add so that the w is ready ?
sorry it worked
This may be a common issue. Plugins register method channels and message channels in onAttachEngine
, While the window engine started, those channels will be registered again. That will cause the call from the main engine(the app) missing response.
Known issues: #6
Currently I don't know how to handle this issue. Discussion is welcome!
../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_floatwing-0.2.0/lib/src/provider.dart:143:30: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.
Screen shows a scrollable windows, but appears to not respond to anything.
Flutter 3.0.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 676cefaaff (13 days ago) • 2022-06-22 11:34:49 -0700
Engine • revision ffe7b86a1e
Tools • Dart 2.17.5 • DevTools 2.12.2
Flutter Doctor: all ok
您好,我缩减了一个demo,可以提现这个问题,您有时间拉取一下看看。
The WindowDestroy
event which gets called when closing a window is not returning any value in the data
i.e. forceClose
value.
I am listening to the event in this manner:
_window?.on(EventType.WindowDestroy, (Window window, dynamic data)
The event call gets notified but data is empty.
Also seeing an error in the console:
W/FlutterJNI(17960): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++.
Could not send. Channel: im.zoe.labs/flutter_floatwing/window_msg. Response ID: 9
Thanks for the great package!
Flutter: 3.3.10 (stable)
Android SDK: 31.0.0-rc4
flutter_floatwing: ^0.2.1
I'm trying to run a simple test, where I show an overlay with the entry-point
. But the window doesn't start/create, instead null
is returned. The followings are the logs -
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:61440/5XyFBiJrhLk=/ws
D/FloatwingPlugin( 9392): [plugin] pixel radio already exits
D/FloatwingPlugin( 9392): [plugin] system config already exits: {"pixelRadio":2,"screen":{"width":1080,"height":2208}}
[log] [plugin] initialize result: {permission_grated: true, pixel_radio_updated: false, system_config_updated: false, service_running: false, windows: null}
[log] [plugin] there are 0 windows already started
D/FloatwingService( 9392): [service] wait for service created
I/FloatwingService( 9392): [service] create a window: default {entry=myOverlayMain}
D/FloatwingService( 9392): [service] wait for service created
I/flutter ( 9392): [ DEBUG ]: window null
I also noticed that awaiting the openPermissionSetting()
doesn't actually wait for permission from the user/settings.
await FloatwingPlugin().openPermissionSetting();
Run the following code -
import 'package:flutter/material.dart';
import 'package:flutter_floatwing/flutter_floatwing.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
FloatwingPlugin().initialize();
runApp(const RootApp());
}
@pragma("vm:entry-point")
void myOverlayMain() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Material(
color: Colors.transparent,
elevation: 0.0,
child: Container(
width: 100,
height: 100,
color: Colors.black,
),
),
),
);
}
class RootApp extends StatelessWidget {
const RootApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text("Floatwing Test"),
),
body: Center(
child: TextButton(
onPressed: _startWindow,
child: const Text("Start"),
),
),
),
);
}
void _startWindow() async {
// check permission and service status
final bool hasPermission = await FloatwingPlugin().checkPermission();
final bool serviceStarted = await FloatwingPlugin().isServiceRunning();
if (!hasPermission) {
await FloatwingPlugin().openPermissionSetting();
// ☝️ it doesn't wait for the value returned by permissions
}
if (!serviceStarted) {
await FloatwingPlugin().startService();
}
// start overlay window
final Window? window = await WindowConfig(
entry: "myOverlayMain",
).to().create(start: true);
debugPrint("[ DEBUG ]: window $window");
}
}
flutter doctor -v
Flutter assets will be downloaded from https://mirror.sjtu.edu.cn. Make sure you trust this source!
[✓] Flutter (Channel stable, 3.7.5, on Microsoft Windows [版本 10.0.22621.1265], locale en-US)
• Flutter version 3.7.5 on channel stable at D:\Github\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c07f788888 (2 days ago), 2023-02-22 17:52:33 -0600
• Engine revision 0f359063c4
• Dart version 2.19.2
• DevTools version 2.20.1
• Pub download mirror https://mirror.sjtu.edu.cn/dart-pub
• Flutter download mirror https://mirror.sjtu.edu.cn
点击assitive_touch出现异常。
PlatformException (PlatformException(error, java.lang.Long cannot be cast to java.lang.Integer, null, java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at im.zoe.labs.flutter_floatwing.FloatWindow$Config$Companion.from(FloatWindow.kt:502)
at im.zoe.labs.flutter_floatwing.FloatWindow.onMethodCall(FloatWindow.kt:221)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:322)
at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$2j2MERcK825A5j1fv5sZ7xB2Iuo.run(lambda)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6197)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:892)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
))
你好,我的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
In release mode, an error occurs,
E/flutter (17069): [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: NoSuchMethodError: No top-level getter 'androidWindow' declared.
E/flutter (17069): Receiver: top-level
E/flutter (17069): Tried calling: androidWindow, stack trace: #0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:222)
E/flutter (17069):
E/flutter (17069): [ERROR:flutter/runtime/dart_isolate.cc(681)] Could not resolve main entrypoint function.
E/flutter (17069): [ERROR:flutter/runtime/dart_isolate.cc(165)] Could not run the run main Dart entrypoint.
E/flutter (17069): [ERROR:flutter/runtime/runtime_controller.cc(381)] Could not create root isolate.
E/flutter (17069): [ERROR:flutter/shell/common/shell.cc(580)] Could not launch engine with configuration.
Determine whether the current thread is a float ?
Hi,I have a problem running the application
E/flutter (18685): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method window.start on channel im.zoe.labs/flutter_floatwing/window) E/flutter (18685): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:175:7) E/flutter (18685): <asynchronous suspension> E/flutter (18685): #1 Window.start (package:flutter_floatwing/src/window.dart:114:12) E/flutter (18685): <asynchronous suspension> E/flutter (18685):
Hi, great package!
I tried to run the example app and couldn't run it. So I've decided to create a minimal app based on the docs but couldn't run either.
I'm using the views for example folder and this is the code that I'm using for the main app
import 'package:floating_app/views/night.dart';
import 'package:floating_app/views/normal.dart';
import 'package:flutter/material.dart';
import 'package:flutter_floatwing/flutter_floatwing.dart';
import 'views/assistive_touch.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
routes: {
'/': (_) => const MyHomePage(title: 'Flutter Demo Home Page'),
'/normal': (_) => NormalView(),
'/night': (_) => NightView(),
'/assistive': (_) => AssistiveTouch(),
},
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
FloatwingPlugin().checkPermission().then((v) {
if (!v) FloatwingPlugin().openPermissionSetting();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FloatingActionButton(
onPressed: () async => initializeSerices(),
tooltip: 'Increment',
child: const Icon(Icons.play_arrow),
),
FloatingActionButton(
onPressed: () async => _createWindow(),
tooltip: 'Increment',
child: const Icon(Icons.add),
),
FloatingActionButton(
onPressed: () async => _createWindow2(),
tooltip: 'Increment',
child: const Icon(Icons.minimize),
),
],
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
Future<void> initializeSerices() async {
await FloatwingPlugin().initialize();
await FloatwingPlugin().isServiceRunning().then((v) async {
await FloatwingPlugin().startService().then((_) {
print("start the backgroud service success.");
});
});
}
Future<void> _createWindow() async {
final window = await WindowConfig(id: 'test2', route: '/normal')
.to()
.on(EventType.WindowCreated, (w, _) {
print('TEST');
}).create(start: true);
}
Future<void> _createWindow2() async {
final windows = FloatwingPlugin().windows;
final window = await WindowConfig(
id: 'test2',
entry: null,
callback: myOverlayMain,
).create(start: true);
}
}
void myOverlayMain() {
runApp(((_) => NormalView()).floatwing(app: true).make());
}
If I click in the play button, then plus, then minimize, these are the logs that I'm getting:
D/FloatwingPlugin( 9657): [plugin] pixel radio already exits
D/FloatwingPlugin( 9657): [plugin] system config already exits: {"pixelRadio":2,"screen":{"width":1080,"height":1794}}
[log] [plugin] initialize result: {permission_grated: true, pixel_radio_updated: false, system_config_updated: false, service_running: false, windows: null}
[log] [plugin] there are 0 windows already started
D/FloatwingService( 9657): [service] wait for service created
I/flutter ( 9657): start the backgroud service success.
I/FloatwingService( 9657): [service] create a window: test2 {entry=main, route=/normal}
D/FloatwingService( 9657): [service] wait for service created
[log] [event] register listener window.created for Window[test2]@834626997, EventManager@193599441, config: {"entry":"main","route":"/normal"}
What am I doing wrong? The permission is added in the AndroidManifest and granted in the initState dialog.
I'm using Flutter 3.0 and created a new project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.